The attack happened in the town of Hangu, which is close to Pakistan's semi-autonomous tribal belt on the Afghan border where Taliban and Al-Qaeda-linked militants have carved out strongholds.
"At least 12 people were killed and 28 others wounded," district police chief Mian Muhammad Saeed told AFP.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
There was no immediate claim of responsibility for the attack, but Hangu has been a flashpoint for Taliban violence and attacks on minority Shiite Muslims.
There are two mosques in the area of Friday's attack, one Sunni and one Shiite, and it was not immediately apparent which one was targeted.
