Captain Sabriye Hassey told Press TV on Saturday that the bomb exploded on SOS Street in north Mogadishu.
Five government soldiers were among the victims and eight servicemen sustained injuries, the Somali military official said.
Hundreds of onlookers gathered on the scene in the aftermath of the powerful explosion.
Witnesses said that three civilians had also sustained injuries in the incident, with one dying from his wounds moments later.
Somalia has not had a functioning government since 1991, when warlords overthrew former dictator Mohamed Siad Barre.
Strategically located in the Horn of Africa, the country remains among the ones generating the highest number of refugees and internally-displaced persons in the world.