"Several armed men in vehicles equipped with anti-aircraft guns surrounded the ministry of justice," Walid Ben Rabha, head of the ministry's information department, told AFP.
"They asked the minister and staff present to leave their offices and close the ministry."
Dozens of gunmen in Tripoli making the same demand have kept Libya's foreign ministry under siege since Sunday, paralysing its work.
Libya's interior ministry and the national television station have also been attacked.
On Monday, angry police officers firing their guns in the air stormed the interior ministry demanding higher wages.
Prime Minister Ali Zeidan has denounced the encircling of the foreign ministry and other such attacks.
On Sunday, he appealed to Libyans to support the government in resisting armed groups "who want to destabilise the country and terrorise foreigners and embassies", but said the government would "not come into confrontation with anyone".
Gunmen have said their siege of the ministries would be lifted when their demands are met by a vote in the General National Congress – Libya's highest political authority – on a Bill calling for the expulsion of former regime employees.
The Congress is studying proposals for a law to exclude former Gaddafi regime officials from top government and political posts.
The proposed law could affect several senior figures in the government and has caused waves in the country's political class.
In March, demonstrators encircled the assembly itself, trapping members in the building for several hours as they called for the adoption of the law.
After the siege was lifted, gunmen targeted Congress chief Mohammed Megaryef's motorcade without causing any casualties.
Libya's government is struggling to assert its influence across the country, where former rebels who fought Gaddafi in the 2011 uprising still control large amounts of territory.
The latest events illustrate a rise in violence in Tripoli where a car bomb struck the French embassy last Tuesday, wounding two French guards and a girl living nearby. – AFP