No group immediately claimed responsibility for the bombing in Payee Khan, a village in Mohmand Agency that is part of the lawless Federally Administered Tribal Areas (FATA) bordering Afghanistan.
"The suicide bomber was in a crowded mosque, he shouted 'Allahu akbar' (God is greatest) and then there was a huge blast," Naveed Akbar, deputy administrator of Mohmand Agency, told Reuters.
Akbar added that some fatalities appear to have been caused when part of the mosque caved in from the force of the blast.
"A portion of the mosque and verandah collapsed in the blast and fell on worshippers. We are still retrieving bodies and the injured from the rubble of the mosque," he said.
Local tribal elder Haji Subhanullah Mohmand said the attack may have been carried out by Islamist militants seeking revenge after local tribesmen gathered a volunteer force and killed one and captured another insurgent.
"It seems to have enraged the militants and they got their revenge by carrying out a suicide attack in a mosque today," Mohmand said.
Pakistan's frontier regions, which are deeply conservative and hard to access due to rough terrain, have long been the sanctuary of fighters from al Qaeda, the Taliban and other militant groups.
In 2014 the army launched a major operation in other parts of FATA including North and South Waziristan against insurgents who routinely attacked government officials and civilians.
Pakistan Prime Minister Nawaz Sharif condemned the bombing and said the "attacks by terrorists cannot shatter the government's resolve to eliminate terrorism from the country."
Security in Pakistan has improved in recent years - the military says "terrorist incidents" dropped from 128 in 2013 to 74 last year - but Islamist extremists continue to stage major attacks.
A bombing of lawyers in the city of Quetta killed 74 people last month, an attack claimed by both the Islamic State and Jamaat-ur-Ahrar, a breakaway faction of the Pakistani Taliban.
Jamaat-ur-Ahrar also claimed the Easter Sunday bombing in a park in the eastern city of Lahore that killed 72 people, many of them children.
Most of the myriad militant groups that stage attacks inside Pakistan seek to overthrow the government to establish an Islamic theocracy and impose a stricter interpretation of the religion than is practised in much of the country.
Other armed groups based in the country target neighbouring Afghanistan and Indian-controlled Kashmir.
Thumbnail/Banner Credits: Reuters