The blast struck as Muslims gathered for Friday prayers in the village of Payee Khan in Mohmand Agency district.
“The suicide bomber was in crowded mosque, he shouted 'Allahu Akbar', and then there was a huge blast,” Naveed Akbar, deputy administrator of the region, told Reuters.
Officials said at least 25 people were killed and 30 injured and there were fears the death toll could rise as rescue operations continued.
Pakistani Taliban faction Jamaat ul-Ahrar claimed responsibility for the attack, with local tribal elder Haji Subhanullah Mohmand suggesting it may have been revenge for the killing of a militant by tribal volunteers.
“It seems to have enraged the militants and they got their revenge by carrying out a suicide attack in a mosque today,” he said.
Nawaz Sharif, the Prime Minister of Pakistan, condemned the bombing and said “attacks by terrorists cannot shatter the government's resolve to eliminate terrorism from the country.”
The military says security is improving, with recorded “terrorist incidents” dropping from 128 in 2013 to 74 last year - but Islamist extremists continue to stage major attacks.
Friday's bombing came a day after a woman was killed by a grenade in Lower Mohmand Agency when militants attacked a pro-government tribal elder's home.
Mohmand lies in Pakistan's Federally Administered Tribal Areas, a semi-autonomous tribal region bordering Afghanistan.
Largely deeply conservative, the territory is remote and hard to access, providing sanctuary for extremist fighters targeted in decades of military operations and drone strikes.
Tehrik-i-Taliban (Pakistani Taliban) militants are waging an Islamist insurgency in the area and have launched a series of bombing attacks and assaults on security services.
Its Jamaat ul-Ahrar faction claimed responsibility for a bombing targeting lawyers that killed 74 people in the city of Quetta last month, as well as the the Easter Sunday blasts in Lahore that killed 72 people, many of them children.
Al-Qaeda fighters are also present in Pakistan, while Isis has recently bene seeking to increase its presence in the country and neighbouring Afghanistan, where it has founded an affiliate called Khorasan Province.