The bomber was trying to drive into the Waberi district's police station gate but detonated against the wall instead, Capt Mohamed Hussein told The Associated Press.
Ambulance sirens echoed across Mogadishu, with dozens of soldiers at the scene. Aamin Ambulance Service said it had transported seven bodies and 12 wounded.
The Somalia-based al-Shabab extremist group claimed responsibility for the attack, saying 15 people had been killed including a minister, according to the SITE Intelligence Group, which monitors such groups.
The extremist group has vowed to step up attacks after the recently elected government launched a new military offensive against it. The group also faces a new military push from the United States after President Donald Trump approved expanded operations, including airstrikes.
Al-Shabab last year became the deadliest Islamic extremist group in Africa, with more than 4,200 people killed in 2016, according to the Washington-based Africa Center for Strategic Studies.
Disclaimer: No Business Standard Journalist was involved in creation of this content