The funeral was for the relative of a pro-government, ethnic Pashtun tribal elder near the northwestern city of Peshawar
, the administrator, Siraj Ahmed, told Reuters.
The attacker mingled with the mourners before setting off his explosives, Ahmed said. "The death toll for now is 34 but it will rise further," he added.
"People had gathered and had just started praying when a boy walked in and blew himself up," survivor Mohammad Eman told Geo television.
There was no immediate claim of responsibility, but Taliban
and al Qaeda militants have staged similar attacks, many in the northwest near the border with Afghanistan, where the military is battling insurgents.
Bloodied shoes and caps littered the ground where the attack took place, on the outskirts of the city, as stunned survivors milled around or bundled the wounded into trucks and away to hospital, television images showed.
"When we heard the blast, we knew something terrible had happened," said Anwar Khan, the owner of a transportation company who also said he had helped ferry up to 60 people to hospital.
"We rushed to the place and it was like doomsday.. There were dead and injured lying all around."
The Pashtun elder whose relative was being buried on Wednesday is involved with a pro-government militia force. It was not immediately clear if he had been killed or wounded in the explosion.
The attack came a day after militants set off a car-bomb at a natural gas filling station in the central city of Faisalabad killing 25 people and wounding about 125.
i Taliban fighting to bring down the U.S.-backed government claimed responsibility for that attack.
The army says that several military offensives over the past three years have weakened the militants but bomb attacks are still common.