The deadly assault has been claimed by the Islamist terrorist group al-Shabaab.
Government security forces are still engaged in a fierce firefight with gunmen inside the building in the capital Mogadishu, which has offices for both the labour ministry and works ministry, a police captain said.
Saqar Ibrahim Abdalla, Somalia’s deputy minister of labour and social affairs, was killed in his ground-floor office shortly after the terrorists stormed the building.
So far eight other people are confirmed to have died in the attack, but the death is expected to rise. At least 20 people have also been injured.
Scores of civil servants remain trapped inside the office block, which is billowing with white smoke according to witnesses.
Al-Shabaab, which is allied with al-Qaeda and seeks to create an Islamic state in Somalia, said its fighters launched today’s attack.
A car packed with explosives was driven into the building before detonating, which then allowed a second group of gunmen to storm inside.
Although al-Shabaab was forced out of Mogadishu in 2011 and no longer controls any significant territory, it continues to carry out deadly attacks.
In February, 24 people were killed when the terrorist group exploded two car bombs in a popular leisure district of the capital.
A large force of African Union peacekeepers is stationed in Somalia to help the country’s fragile government keep al-Shabaab at bay and there are also hundreds of American troops.
The US also regularly carries out airstrikes against al-Shabaab in an effort to kill the group’s fighters and make it harder for them to threaten the Somalian authorities.
According to the Bureau of Investigative Journalism, in 2018 the US launched 45 air and drone strikes against the terrorist group which killed about 330 people.
Earlier this week Amnesty International accused the US military of committing war crimes by killing large numbers of civilians in their air strike campaign in Somalia.
But American military leaders denied they had killed or wounded a single civilian in the 110 air strikes carried out since June 2017.