The attack was claimed by the al-Qaida-linked Al-Shabab group and also wounded 20 people. The walled, luxury Jazeera Hotel is considered the most secure in Somalia's capital and is frequented by diplomats, foreigners and visiting heads of state.
"This is really scary - destroying the Jazeera hotel like this means no blast walls can make anyone safe," said bystander Yusuf Mohammed.
The blast destroyed at least eight rooms and stunned the residents of the Somali capital.
The attack comes as Somali forces backed by troops from the African Union have launched an offensive, dubbed Operation Jubba Corridor, against militants, pushing them out of two key towns. The coalition already drove al-Shabab out of the capital.
More From This Section
The Al-Qaeda linked group often carries out such attacks when it feels under pressure by the coalition forces.
They said the hotel was targeted because it hosts "Western" embassies which are helping to coordinate the offensive.
The attack came as President Barack Obama was leaving neighboring Kenya for Ethiopia. The president's visit has included discussions about how to deal with the threat of al-Shabab.