The bomb went off outside the National Database and Registration Authority (Nadra) office in the town of Mardan, BBC reported.
A faction of the Pakistani Taliban said it carried out the attack, which left more than 30 others wounded.
The attack is one of the deadliest since last December’s massacre of 150 pupils and teachers in Peshawar.
The bomber in Mardan reportedly arrived on a motorbike and blew himself up when stopped by a security guard outside the Nadra building.
The office is usually crowded with people lining up to get ID cards.
The Bach Khan Medical complex has received at least 16 dead bodies and dozens of injured people, Reuters reports.
If the attacker had not been stopped by a security guard at the office’s gate, the death toll would be significantly higher, Mardan police Deputy Inspector General Saeed Wazie told BBC.
He said up to 12 kilograms of explosive material may have been used in the blast.
Jamaat-ul-Ahrar, which split from the Pakistani Taliban in 2014, said it carried out the attack on what it called the “heathen Pakistan state”.
The group, along with others, claimed responsibility for an explosion that killed more than 50 people at the Wagah border crossing with India in 2014.
The bombing is one of the deadliest since a security crackdown following the Peshawar school massacre a year ago that saw 150 people killed by the Pakistani Taliban.
Offensives against insurgents have reduced major militant attacks from dozens every month in 2014 to no more than one or two a month this year.
Mardan is 30 miles (50km) north-west of Peshawar, the capital of Khyber Pahktunkhwa province.