The bombing in Sibi, a town in the province of Balochistan, occurred minutes after a convoy carrying Pakistan's President Arif Alvi passed through the area, police official Akhtar Rasool said.
Alvi was in the town to participate in a cultural event.
It was not immediately known if he was the target, another police officer Ajmal Baloch said.
No one immediately claimed responsibility for the attack.
At least five bodies and 28 people with injuries were brought to the town's main hospital, doctor Sarwar Hashmi said.
The bombing occurred days after a pair of suicide bombers sent by the extremist Islamic State group killed at least 63 people at a Shiite mosque in the northwestern city of Peshawar.
Violence has surged in Pakistan since the Taliban swept to power in neighbouring Afghanistan.
Officials said most groups behind the recent bombings operate from across the border.
Balochistan, Pakistan's largest but most volatile province, has been targeted by Islamist militants, Sunni sectarian groups and nationalist separatists in recent months.
The violence is seen as a reaction by rebels to China's investment plans in the region linking its Xinjiang province with the Arabian Sea through a network of roads and rail tracks.
The proposed $US60-billion ($A82-billion) China-Pakistan Economic Corridor plan is meant to give China access to markets in the Middle East, Europe and Africa through the shortest overland and sea route.