Witnesses said government workers were among those killed in the first attack.
Colonel Ahmed Mohamed said the death toll could rise as security forces battle several gunmen holed up inside.
At least 13 people were wounded on Saturday in a suicide auto bombing near Somalia's presidential palace and another blast outside a police station close by in the capital, the emergency services said.
Police Captain Mohamed Hussein said the attack began on Saturday morning when a suicide auto bomber detonated his explosives at the gate of the interior ministry, located close to the presidential palace and the headquarters of parliament.
The police revealed that the attackers who are believed to be militants from al-Shabaab terrorist network had gained access to the building. It was blamed for the October truck bombing that killed more than 500 people in the deadliest attack in the country's history.
Warframe Announced for Nintendo Switch
Digital Extremes' Warframe has had a great run so far on PS4, Xbox One, and PC, with over 38 million registered players. Warframe is also known for it flexible mod system, the ability to join clans, and massive open worlds.
The compound, which is located in one of the busiest areas in Mogadishu, is close to the parliament headquarters and the presidential palace. Another blast went off outside a police station nearby.
The United States under the Trump administration has stepped up military efforts in Somalia, including dozens of drone strikes, against al-Shabab and a small presence of fighters linked to the Islamic State group.
In a separate incident on Saturday, a roadside bomb killed a former district commissioner in the Lower Shabelle region and wounded three others, according to police.
Local media reported that 17 people - mostly civilians - were also wounded in the attacks. Al-Shabab also has claimed responsibility for this attack.