The blast in the early hours on Thursday near the K4 junction in the heart of the city triggered a plume of smoke, witnesses said, adding that they heard sounds of gunfire.
"So far we know five people died and 23 others (were) injured,” Abdikadir Abdirahman, the director of Aamin Ambulance services, told the Reuters news agency.
Mohamed Hussein, a nurse at the nearby Osman Hospital, told Reuters that they "were shaken by the blast pressure, then deafened by the gunfire that followed.”
Hussein said he had been pulled from the rubble of a collapsed ceiling. "Our hospital walls collapsed. Opposite us is a school that also collapsed. I do not know how many died,” he said.
The blast collapsed the walls of nearby schools and left cars mangled.
Somalia armed group al-Shabab claimed responsibility for the deadly attack. Sheikh Abdiasis Abu Musab, the group’s military operations spokesman told Reuters that the explosion was aimed at a United Nations convoy.
The al-Qaeda-linked armed group said in a statement carried by its Andalus radio that it was going after Western officials being escorted by the African Union peacekeeping convoy.
Al-Shabab has been fighting Somalia’s central government for years to establish its own rule based on its strict interpretation of Islamic law.