The attack occurred on Saturday afternoon in Buloburde, a city in Hiran district where government forces and clan militias have been battling the Al-Qaeda-linked insurgents since the middle of last year.
The bomber detonated a car laden with explosives near an administrative building, said Abdullahi Mohamud, a local police commander.
"Five people were killed on the spot, while three others died overnight in hospital," he said on Sunday, adding the bomber had been planning to destroy the city's main bridge before redirecting the attack at a civilian area.
Witnesses said the explosion damaged buildings and the city's main mosque.
"I saw the bodies of five people. Two were elders coming out of the mosque," said Muhidin Sokorow, who witnessed the blast.
Separately, police said a car bomb was detonated in Jalalaqsi, another town in Hiran, but only the attacker died.
A second attack was foiled and the suspect detained trying to flee a vehicle packed with explosives, police said.
Al-Shabaab claimed responsibility for all three attacks in a message transmitted via its communication service.
The militants have been waging a bloody insurgency against the frail internationally-backed central government for 15 years, carrying out attacks both in Somalia and neighbouring countries.
In recent months, the army and local clan militias have retaken swathes of territory in the centre of the country in an operation backed by US air strikes and an African Union force.
But the insurgents have frequently retaliated with bloody attacks, underlining their ability to strike at the heart of Somali towns and military installations despite the offensive.
Nineteen people were killed in twin car bombings in Mahas, a town in Hiran, earlier this month.