Colonel Ahmed Mohamud says those killed in the Saturday morning blast include soldiers and civilians.
Captain Mohamed Hussein says the bomber targeted a military checkpoint near the rear entrance of the heavily fortified palace.
Police say lawmakers and other officials had been traveling nearby on what is a business day in the Horn of Africa nation.
A second blast was heard shortly afterward nearby in Mogadishu as a plume of smoke rose over the capital.
There is no immediate claim of responsibility for the blast. The al-Qaeda-linked al-Shabaab extremist group often targets the capital.