"The security forces are in control now and the last terrorist was shot and killed", Mohamed Abdiweli, a security official, said.
"There are dead bodies and wounded people strewn inside the hotel and we cannot give exact details of the casualties but we have confirmed so far 12 people killed and more than thirty others wounded," Abdiweli said.
"We believe... there were four gunmen involved in the attack and the death toll could be higher because we see (the) devastating consequences of the (bomb) blast and gunfire," he added.
Authorities said on Friday a suicide bomber rammed a vehicle loaded with explosives into the Medina hotel in the port town of Kismayo before several heavily armed gunmen forced their way inside, shooting as they went.
"The blast was very big," said witness Hussein Muktar.
"There is chaos inside, I saw several dead bodies carried from the scene and people are fleeing from the nearby buildings," Muktar said during the assault.
The attack is the latest in a long line of bombing and assaults claimed by the Al-Qaeda-linked group.
Witnesses said among those killed were a well-known social media activist, her husband and a local journalist.
"The relatives of local journalist Mohamed Sahal confirmed his death and I'm getting that social media activist Hodan Naleyeh and her husband also died in the blast," witness Ahmed Farhan said.
The Somali journalists' union SJS confirmed the reporters' deaths. "It is a very sad day for Somalian journalists," the union's secretary-general Ahmed Mumin said in a statement.
Shabaab claimed responsibility for the attack in a statement.
"Mujahidin fighters carried out a martyrdom attack on one of the hotels accommodating the apostate officials of the Jubaland administration," the group said, referring to an autonomous southern zone in the troubled country whose main city is Kismayo.
According to several sources, most of those staying in the hotel were politicians and traders ahead of upcoming regional elections.
Shabaab fighters have fought for more than a decade to topple the Somali government.