A second blast could be heard in the area minutes later.
Captain Mohamed Hussein said the gunfire could still be heard inside the Nasa-Hablod hotel, which is close to the presidential palace and is frequented by politicians and other members of Mogadishu's elite.
Today's blasts came two weeks after more than 350 people were killed in a massive truck bombing on a busy Mogadishu street in the country's worst-ever attack.
The extremist group al-Shabab often targets high-profile areas of Mogadishu. There was no immediate claim of responsibility today.
Since the blast two weeks ago, President Mohamed Abdullahi Mohamed has been visiting regional countries to seek more support for the fight against the extremist group.
A 22,000-strong multinational African Union force in Somalia is expected to withdraw its forces and hand over the country's security to the Somali military by the end of 2020.
The US military also has stepped up military efforts against al-Shabab this year in Somalia, carrying out nearly 20 drone strikes.