The assault underscores the continuing ability of the al-Qaeda-allied militants to stage deadly attacks with sometimes high casualties inside the city even as President Hassan Sheikh Mohamud's government pursues an offensive against them.
On Sunday night, the militants stormed the Villa Rose hotel, near the presidential residence shooting and setting off explosives. Some government officials who were inside as the attack begun escaped via its windows, according to police.
"There is still heavy gunfire inside the hotel and we hear explosions from time to time ... we are still in our houses since last night, when the siege started," Ismail Haaji, a resident who lives near the hotel, told Reuters early on Monday.
Special forces units, known as Gaashaan and Haramcad, had taken over operations, said a police officer at the scene who spoke on condition of anonymity.
"The fighters who launched the attack are still fighting inside the hotel, and they are fighting with the forces of Haramcad and Gaashaan, and security forces are trying to rescue the people trapped inside the hotel," the officer said.
The number of casualties from the siege and the number of people rescued were not yet clear.
Government officials frequently use the Villa Rosa hotel for meetings.
Somalia's parliament postponed a scheduled session for both of its houses on Monday as the siege unfolded.
Al-Qaeda-linked al-Shabaab, which controls large swathes of the country, claimed responsibility for the attack, saying it was targeting the nearby presidential palace.
Somalia's environment minister Adam Aw Hirsi tweeted that he survived the attack, saying the attack on Villa Rays where he and other government officials reside was by no means a manifestation of emboldened terrorists.
"To the contrary, the desperate move shows that the terror kingpins running for dear life are throwing their last kicks," Hirsi said. "We'll not let up the war."
Somalia government forces, supported by clan militias and, at times, African Union troops and US air strikes have made a number of battlefield gains in offensive against al-Shabaab during the past three months.
The US military has conducted several air strikes against the al-Shabaab this year, but it was not clear whether it was involved in Monday's battle.