Gunfire rang out as fighters entered Dayah Hotel, in Mogadishu, Somalia. A second blast shook the area shortly afterwards, injuring several people nearby.
Colonel Abdiqadir Hussein, a police officer, told Reuters security forces later managed to secure the building, which is popular with politicians.
"We have rescued the people and concluded the operation at Dayah hotel. The security forces are now inside the hotel and we shall give further details of casualty later," he said.
Another police officer, Major Mohamed Ahmed, said a dozen people had been wounded, in addition to the 13 killed who included members of the security forces and civilians. "The death toll may rise," he added.
Somalia Terror Attack
Wed, January 25, 2017
At least seven people were killed after two car bombs exploded outside a popular Mogadishu hotel, and gunmen forced their way inside the building and opened fire, police said.
1 of 7
A general view shows the scene of a secondary explosion in front of Dayah hotel in Somalia's capital Mogadishu
Explosion at hotel in Somalia – mass casualties feared
Duniye Mohamed, a doctor at Madina hospital where some casualties were taken, said the injured included people with "very serious" wounds.
Islamist group Al Shabaab, which until 2011 controlled Mogadishu and much of Somalia, claimed responsibility for the attack.
"Well-armed mujahideen (fighters) attacked the hotel, and now they are fighting inside the hotel," reported Somalia's Andalus radio, which is linked to al Shabaab.
Get Quotes on Home Insurance
Hotel Dayah in Mogadishu is popular with locals
Hotel attacked in Somalia leading to fears for MPs and foreign journalists
Emergency responders put on suits after explosion in Oxford
Devastating scenes following explosion in Paris
Emergency services arrive after huge explosion in Hornchurch
The insurgents often launch bomb and gun attacks in the capital, saying they want to topple the Western-backed government and impose their strict interpretation of Islam on the nation.
In the past two years, a campaign by African Union troops and Somali forces has driven the group out of key urban strongholds, but it remains active from bases in rural areas.
The Horn of Africa country swore in nearly 300 members of its parliament last month. The lawmakers will also pick the president, although that vote has repeatedly been postponed.