The Islamist group al Shabaab claimed responsibility for the huge blast which rocked Mogadishu and injured at least 23 people, including school students, sending a column of smoke above the city. Gunfire echoed around the scene, witnesses said.
It was not immediately clear if any UN personnel were among those killed or injured in the huge blast, which targeted the UN convoy as it passed near the site of a school.
UN officials did not immediately respond to requests for comment.
"We counted eight dead people and 17 others including 13 students injured," police spokesman Abdifatah Aden Hassan told reporters. He said a suicide bomber in an SUV full of explosives had targeted a UN security convoy.
Aamin Ambulance service evacuated at least 23 people who were injured in the blast, Abdikadir Abdirahman, the director of the service, told Reuters.
Abdiasis Abu Musab, al Shabaab's military operations spokesman, confirmed the Islamist group's operatives had carried out the attack and said they were targeting a UN convoy.
The blast near the K4 junction in the heart of Mogadishu was so large that walls of the nearby Mucassar primary and secondary school collapsed. Cars were mangled in the explosion.
"We were shaken by the blast pressure, then deafened by the gunfire that followed," said Mohamed Hussein, a nurse at the nearby Osman Hospital, saying 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.
Al Shabaab has been fighting Somalia's central government for years, seeking to take power and impose its strict interpretation of Islam's sharia law.
The group frequently carries out bombings and gun assaults in Somalia and elsewhere in its war against the Somalia military and the African Union-mandated AMISOM force that helps protect the government.