Gunmen used 2 car bombs to blast their way into the Sahafi hotel compound before storming the building, police said.
Police said those killed included the hotel owner, a lawmaker, a former senior military commander, a radio journalist and other civilians.
The attack came a day after deadly clashes between jihadist fighters and African Union (AU) troops in the Bakool region near the border with Ethiopia.
According to Sheikh Abdiasis Abu Musab, al Shabaab’s military operations spokesman, Mujahideen entered and took over Sahafi hotel where enemies lived.
African Union’s AMISOM force and government forces say they have regained control of the hotel after a fierce gun battle.
Somali president Hassan Sheikh Mohamud condemned the attack, perpetrated, he said, by “an increasingly desperate, internally-divided group of extremists … (who) seek to grab the headlines through killing innocent Muslims.”
He urged Somalians “to prevent extremists from distorting the faith of our fathers, and leading people astray in their quest for brutality and destruction. We must do this by confronting their distorted ideology and liberating Somalia from them entirely.”
Al Shabaab is fighting to oust the Mogadishu government and install a strict version of Shariah law.
The group has also attacked neighbouring countries that have sent troops to support the Mogadishu government.