Among the dead was a Somali-American woman, Fahia Bashir Nur, 45, of Alexandria, Virginia, according to her uncle, Yusuf Kheire. He said Nur and her mother were dining in the hotel when the attack began. The mother lost an arm in the attack and was hospitalized.
The attack, which lasted hours, began when gunmen raided the hotel in Mogadishu on Friday evening.
Yusuf Mohamed Ismail Bari-Bari, Somalia's permanent representative to the United Nations in Geneva, Switzerland, was among those killed in the attack, the Somali government said.
"He will be remembered for his strong personal commitment to protecting and promoting human rights for all," Nicholas Kay, special representative of the United Nations Secretary-General to Somalia, said of Bari-Bari.
Islamist militant group Al-Shabaab claimed responsibility.
The attack started about 5 p.m. local time when a car bomb exploded at the hotel's entrance, according to witness Aden Hussein, who said he was nearby when the blast happened.
Gunmen then stormed into the hotel and opened fire, Hussein said.
They overpowered the hotel's security guards, said police Capt. Ahmed Abdi, adding that the gunbattle between Somali special forces and the attackers lasted at least 17 hours.
One of the attackers, who was wearing a belt with explosives, blew himself up inside the hotel, police Capt. Ahmed Abdi said.
Some members of the terror group "stormed into the first, second and third floors of the hotel where rooms are located and held several people hostage," according to a statement from the African Union Commission in Somalia, a peacekeeping mission.
The Makka Al Mukarama hotel, located along a highway leading to the country's presidential palace, is popular with lawmakers, journalists, business people and Somalis returning home from abroad.
Somali President Hassan Sheikh Mohamud condemned the attack as a "heinous and inhuman act" in an interview with state-run Radio Mogadishu during an official visit to Egypt.
In a statement, Somali Prime Minister Omar Abdirashid Ali Sharmarke said Al-Shabaab's "talk of 'legitimate targets' and 'justification'" exposes "the sham logic behind their lust for terror."
"These terrorists contradict Islam and betray Somalia," he said.