Another 20 people were wounded in the attack, which lasted for several hours on Thursday night, police spokesman Qasim Roble told news website Somali Update.
However, the number of victims and wounded could increase, said the health emergencies company, Mogadishu Ambulance Services, which took part in the evacuation of the wounded to various hospitals in the Somali capital.
Special forces rescued most of the civilians trapped in the compound, in which a wedding and a college graduation ceremony were being held.
Al Shabab claimed responsibility for the attack and said the death toll was 20, which the security forces initially denied, calling it "exaggerated".
The attackers detonated a car bomb near the hotel and then stormed it opening fire on guests, who included politicians, musicians and journalists.
This new assault by Al Shabab, affiliated with Al Qaeda, comes just six days after the attack on a military base of the African Union Mission to Somalia, where terrorists killed at least 70 Kenyan soldiers.