"The information we are getting indicates at least four people died and 12 others were wounded but we still don't have more details," security official Ibrahim Mohamed told AFP.
He said "terrorist elements" had rammed two cars packed full of explosives into the headquarters of the police's criminal investigations department in the city center.
Sources heard an exchange of gunfire after the explosions, which took place near a busy junction in the city.
"One of the cars hit the corner of the building and the other hit near the gate. There was smoke and dust and everything was in a mess," said witness Abukar Osman.
There was no immediate claim of responsibility.
The blasts came just days after at least 13 people were killed in twin bombings near Mogadishu airport that happened close to UN and African Union buildings.
That attack was claimed by Shabaab militants fighting to overthrow Somalia's internationally-backed government.
The Shabaab were forced out of the capital five years ago but continue to carry out regular attacks on military, government and civilian targets.
In recent months they have claimed attacks on military bases as well as civilian targets including hotels.
This year is considered critical for the group, which is eager to disrupt an expected change of government due in the coming months.
Somalia was supposed to hold national elections this year but is instead going to hold what diplomats call a "limited franchise election" in which ordinary citizens do not participate.
The UN now hopes a one-person-one-vote election will be possible in 2020, AFP reported.
219-11