Police said the first vehicle bomb went off after suspected militants breached a checkpoint near the president's residence by shooting at security personnel at the checkpoint. Al Shabaab did not claim responsibility for that incident.
"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.
Only a few attacks since September 11 have killed more people.
The second occurred near parliament, where security forces have engaged with gunmen thought to be trying to attack the presidential palace.
The Somalia-based Al Qaeda-affiliated Insurgent group Al-Shabaab quickly claimed responsibility for the attack which comes hours after Somali Security Ministry warned explosives-filled vehicle is in the city.More news: Donald Trump warmly welcomes Australia's Malcolm Turnbull to the White House
More news: Shooting town hall: Rubio on the defensive on gun control
More news: Vehicle strikes security barrier by White House, driver apprehended
He said Somali security officials were pursuing militants who had escaped.
"The security forces foiled the intent of the terrorists".
"I felt the ground shaking under my feet", said resident Mohamud Yusuf, who was near the first blast. "After blasts, we could see a huge cloud of smoke into the air".
Al-Shabaab, which is seeking to establish an Islamist state in Somalia, regularly launches attacks on government buildings, hotels and restaurants in the volatile nation on the Horn of Africa.
Since that attack, the deadliest ever in Somalia, President Mohamed Abdullahi Mohamed has vowed to eradicate al-Shabaab. The attacks came just a day after Somalia's interior ministry issued a warning about possible auto bombs.