In addition to the deaths, at least eight people were wounded in the attack, said police officer Mohamed Hussein.
Security forces secured the area around the Banoda restaurant, in Mogadishu, after the attack, said another senior police officer Mohamed Abdi.
The car with the bomb had been parked near Somalia's heavily guarded presidential palace when it exploded, he said.
Although no group immediately claimed responsibility for the attack, it bears the hallmarks of Somalia's Islamic extremist group al-Shabab, which frequently carries out attacks in Mogadishu and throughout Somalia.
More From This Section
Four UN staff working to help Somali children were among those killed in that attack, the UN children's agency announced today.
Al-Shabab, which is allied to al-Qaida, appears to be stepping up attacks in Somalia and across borders even as it loses ground inside Somalia.
Despite losing some of its top leaders in US air strikes and being pushed by African Union forces out of the capital, Mogadishu, and into rural regions mostly in southern Somalia, al-Shabab is still able to carry out deadly bombings against government targets and public places seen as popular with foreigners.