"The first blast took place at the Ministry of Labour ... there are also other ministry buildings near the scene. It was a suicide car bomb followed by gunfire," police officer Major Mohamed Hussein said, adding there had been a second explosion.
Al Shabaab, which is fighting to establish its own rule based on a strict interpretation of Sharia law, said one of its fighter had rammed the ministry building with a car bomb, allowing others to enter it.
"We are inside the building and (the) fighting goes on. We shall give details later," Abdiasis Abu Musab, Al Shabaab's military operation spokesman told Reuters.
Al Shabaab, which is trying to topple Somalia's western backed central government, was ejected from Mogadishu in 2011 and has since been driven from most of its other strongholds.
But it remains a threat, with its fighters frequently carrying out bombings in Somalia and neighbouring Kenya, whose troops form part of the African Union mandated peacekeeping force AMISOM that helps defend Somalia's central government.