No official death toll has been given, but eyewitnesses have reported casualties.
The assault, which occurred on Tuesday morning local time, involved a group of armed militants, according to early reports by police (pictured above).
"A car loaded with explosives rammed the gate and there is gunfire inside the building of the ministry," police official Mohamed Dahir told AFP news agency.
Police officer Maor Ali Nur told Reuters news agency that at least one civilian had been killed.
No group has yet claimed responsibility, but suspicion generally falls on the Somali Islamist group al-Shabab, which stages frequent terrorist attacks in the capital.
Last week, it targeted a hotel in Mogadishu frequented by politicians.
The al-Qaeda-linked organization seeks to extend its control over Somalia and neighboring countries. It controlled Mogadishu between 2007 and 2011 but was pushed out but government and African Union (AU) forces.
Kenya, who has provided support to the AU forces, has increasingly become a target of brutal terror attacks over the past year.
kms/jil (AFP, Reuters)