The car bombings and subsequent gunfire also wounded 20 people, medical workers said.
A loud explosion reportedly took place on Friday, followed by a second blast and sustained gunfire which broke out near the president’s residence. The second blast took place beside a popular hotel.
The Aamin Ambulance service, which confirmed the death toll, transported victims to the hospital.
The armed group al-Shabab claimed responsibility for the attack, Al Jazeera reported.
“As far as we know, there has been one blast beside the presidential palace, and another close to a popular hotel,” Major Mohamed Ahmed, a police officer, told local media.
The attack comes a day after the Somali government had issued a “terror warning” in the capital.
The explosions shattered a months-long period of calm in Mogadishu, which is often the target of attacks by al-Shabab.
In December, 18 police officers were killed when an al-Shabab fighter blew himself up inside the country’s main police academy in Mogadishu.
The capital was also the target of a truck bombing in October that killed 512 people in the deadliest attack in Somalia’s history. The Somali government blamed that blast on the al-Qaeda linked al-Shabab.