The vehicle full of explosives was left in the car park of a mosque near the Somali parliament building in Mogadishu where lawmakers were holding a session.
The parking area is used by lawmakers during parliament sessions.
Security officials said that the vehicle was detonated hours after the lawmakers ended their sessions and none of the lawmakers were harmed in the blast.
It is thought that the lawmakers were the target of the bomb.
A number of other cars in the area were destroyed by the force of the blast, which could be heard miles from the site of the explosion.
The body of a Somali government security official dressed in military uniform could be seen following the blast, but no group immediately claimed responsibility for it. However, al-Qaeda-linked fighters working with the hardline group al-Shebab have conducted a series of guerrilla-style attacks in the capital since pulling out of fixed positions in Mogadishu last year.
The blast coincides with a call by al-Qaeda leader Ayman al-Zawahiri to all Muslims to support al-Shebab in overthrowing the embattled federal government and replace it with Islamic law.
In recent months, al-Shebab has suffered major setbacks, with African Union troops wrestling several strongholds from them.