Colonel Mubarak Abu Dhaheer, who heads the security department in charge of protecting diplomatic missions, said the blast in central Tripoli caused some damage to the building but that no one was hurt.
"This is a criminal act aimed at undermining security and stability and at targeting policemen tasked with guarding diplomatic missions," said Abu Dhaheer.
The jihadist Islamic State (IS) organisation said it carried out the bombing, according to the US-based monitoring group SITE Intelligence.
Three years after dictator Moamer Kadhafi was toppled and killed in a NATO-backed revolt, Libya is awash with weapons and powerful militias, and run by rival governments and parliaments.
Fajr Libya (Libya Dawn), a coalition of Islamist militias, seized Tripoli in August after weeks of deadly fighting with a nationalist group.
The violence triggered an exodus of foreigners from the Libyan capital and prompted the closure of several embassies, with many relocating to neighbouring countries.
In November, two car bombs struck near the shuttered Egyptian and United Arab Emirates embassies in Tripoli. Italy is one of the few countries to keep an embassy open in the Libyan capital.
