Security forces were seen surrounding the area, where cars are inspected en route to the airport and where politicians regularly gather at the hotel.
A suspected suicide car bomb has exploded in Somalia's capital and was followed by a shootout between militants and security forces at a hotel, killing at least three people, witnesses and authorities said.
"So far three people, two of them civilians, and a security guard ware confirmed dead, but the death toll could be higher," said Mohamed Dahir a senior official with with the national security agency.
Six civilians were wounded in the attack, he added.
The militant group Al Shabab, which is linked to al Qaeda, claimed responsibility via its radio station. Al Shabab frequently carries out bombings in its war on Somalia's government, which is backed by the United Nations and African Union (AU) peacekeeping troops.
"A speeding car exploded near the hotel and checkpoint. The blast shook us and heavy gunfire followed," shopkeeper Ali Abdulahi told Reuters of the incident in the busy Kilometre 4 area of the coastal city.
"I suspect the militants entered Hotel Afrik. That is where the exchange of gunfire is now taking place."
Many people rescued
A Reuters journalist saw security forces besiege the area, where cars are inspected en route to the airport and where politicians regularly gather at the hotel.
"The blast made the hotel tremble as we sat inside and were talking. We were panicked, confused," witness Ahmed Nur told Reuters, adding that he escaped via a ladder down a wall.
"I jumped down and ran. I cannot know how things were. I was scared. I heard gunfire and saw dark smoke."
Police spokesman Sadik Ali said many people had been rescued from the Hotel Afrik. "There must be casualties because the militants first started the attack with a suicide car bomb against the wall," he told Reuters.
"The operation still goes on, casualties will be known later."
Al Shabaab's radio Al Andalus said fighters had gone into the hotel after a suicide car bomb.
"A martyrdom operation goes on at Hotel Afrik, which is a cover-up for officials from the apostate government," it said.
Al Shabaab wants to rule Somalia.
There was no immediate word from Somali officials or the AU peacekeeping mission, which supports the government against al Shabaab.
Turkey condemns attack
In a statement, Turkey's Foreign Ministry “strongly condemned” the attack and wished a speedy recovery to those who were injured.
It added that Turkey will continue to stand by the government and people of Somalia in their fight against terrorism.