The attack happened at 13:00 p.m. local time (08:30 a.m. GMT) at the Gul Muhammad mosque in a tribal area in the northwest of the country, local security official Gulab Khan said.
More than 200 people were participating in Friday afternoon prayers at a place of worship at the time of the attack, and it was feared that there could be more victims, said Khan.
The injured were taken to hospitals in the area, which is mountainous and has bad roads, he said, adding that an investigation into the attack had begun.
The attack came one day after Eid al-Adha (The Feast of the Sacrifice) ended in the Muslim country.
Two police officers died and four were injured on Tuesday on the first day of the feast in an explosion in Quetta, hours after a failed suicide attack against a Shiite mosque in the south of the country.
Despite such incidents, Pakistan has seen a fall in the number of terrorist attacks, which the government and army attribute to a military operation that was launched in June 2014 in the northwest of the country against the Taliban.