Al-Shabaab said it had carried out the bombing in Baladweyne, targeting troops participating in an African Union peacekeeping force fighting the Somali Islamist group.
"A man with an explosives jacket entered unexpectedly in the tea shop where soldiers and civilians sat ... and blew himself up," said local elder Ahmed Nur, speaking from the scene of the blast.
At least 16 people were killed and 33 wounded, politician Dahir Amin Jesow said. "The death toll may rise."
Somali and African forces pushed al-Shabaab out of Baladweyne, about 210 miles north of Mogadishu, more than a year ago.
But while the territory that al-Shabaab controls has dwindled over the past two years, it continues to control large rural areas and has ratcheted up guerrilla-style attacks.
"Our main target was Ethiopian and Djibouti troops who invaded our country," said al-Shabaab spokesman Sheikh Abdiasis Abu Musab. He put the death toll at 25.
There was no independent word on whether foreign soldiers were among the casualties.
Horn of Africa analyst Rashid Abdi said: "Al-Shabaab is sending a message that it has the will and the capacity to carry out these kinds of attacks. They are sending a message that they have huge geographic reach."
Al-Shabaab showed its capacity to strike at far-away targets last month when gunmen raided a mall in Nairobi, as punishment for Kenya sending troops to Somalia.
Uganda on Friday heightened its "terror" alert to maximum for the first time since bombings in 2010 that killed 79 people, citing intelligence indications of an attack by al-Shabaab.