The explosions at dawn on Sunday came on the first day of Eid al-Fitr, one of the holiest days in the Muslim calendar, as the city prepared to celebrate a year of freedom since the dictator was ousted by rebels. Security forces immediately launched a hunt for more car bombs, and a warplane circled overhead in what appeared to be an attempt to show strength.
The first explosion near the interior ministry caused no casualties.
Police who rushed to the scene defused a second, unexploded car bomb.
Soon afterwards two more car bombs exploded near the former headquarters of a women's police academy, used by the defence ministry for interrogations and detentions, killing two men passing in a car and wounding three guards.
The attacks did not stop worshippers from heading to mosques for prayers soon afterwards.
"These attacks are an attempt to spoil Eid by the Gaddafi supporters and scare us," said Mohammed Abdul, 44. "But there are very few Gaddafi supporters now and people refuse to be frightened by them."
Tripoli has been remarkably peaceful in recent months with the return of normality and withdrawal of militias from the streets, but officials have been warning of possible attacks by Gaddafi loyalists.
Trials of senior old regime figures have started, Gaddafi's son Saif al-Islam is expected to stand trial within weeks, and negotiations are under way for the return of thousands of Gaddafi supporters who fled to Egypt and Tunisia after his downfall last year. Diehard Gaddafi loyalists oppose the negotiations and officials believe some still think they can wreck the new government and return to power in the ensuing chaos.
Tripoli's security chief Colonel Mahmud al-Sherif said that judging from the method, Sunday's attacks were organised by the same sleeper cell that carried out a bombing in Tripoli on August 3 that wounded one person.
Security remains a problem in the new Libya, especially in the troubled second city Benghazi where there has been a spate of kidnappings and assassinations.
There was no immediate claim of responsibility for Sunday's blasts, and rivalry between militias could have been the cause. There are still occasional stand-offs and shoot-outs between rival armed groups of armed young men which took over Libya's cities during the revolution. But they no longer patrol the streets and the new government which was elected last month is gradually extending its authority.
Libya has also suffered a few terrorist attacks by Islamic extremists in the past year, including an assassination attempt against the British Ambassador in Benghazi in June.
But they have few supporters and are regarded as little more than a nuisance.