In a separate incident, al Shabaab fighters attacked military bases housing government and African Union troops
A car bomb claimed by al Shabaab Islamist militants killed five soldiers outside the president's palace in the Somali capital of Mogadishu and badly damaged two nearby hotels, police said.
Reuters witnesses said gunfire could be heard after the explosion and a huge cloud of smoke could be seen above the president's palace, outside which were the remnants of the car and splattered blood.
"A suicide car bomb exploded outside the presidential palace. So far two hotels opposite the palace are partially destroyed," police officer Major Mohamed Ali told Reuters by phone.
Al Qaeda-linked al Shabaab has claimed responsibility for several recent explosions in Mogadishu, including a car bomb and gun attack last week at a popular beach restaurant in the capital that killed 10 people.
"So far we know five government soldiers died in the blast. It exploded outside the SYL hotel which is also just at the checkpoint outside the palace. We believe the target was SYL which is frequented by officials. The death toll may rise," police officer Colonel Abdikadir Hussein told Reuters.
Al Shabaab's Radio Andaluz said that the group was behind the attack.
In a separate incident, al Shabaab fighters attacked military bases housing government and African Union troops south west of the capital Mogadishu late on Monday, police and the group said on Tuesday.
Military officer Major Bile Farah said a soldier and two al Shabaab fighters were killed in the attack in K-50 and Muri in Lower Shabelle region,
Al Shabaab's military operations spokesman, Abdiasis Abu Musab, said the group's fighters had killed 10 soldiers and commandeered a vehicle from the Somali government soldiers.
The militants were pushed out of Mogadishu by the African Union peacekeeping force AMISOM in 2011 but have remained a serious threat, launching frequent attacks aimed at overthrowing the government.
Seeking to impose its own harsh form of Islam, al Shabaab has also launched attacks in Kenya and Uganda which have contributed troops to the 22,000-strong AMISOM force.