The Islamist militant group said the attack was orchestrated by a commander who was behind December's massacre of 145 people, including 132 children, at a Peshawar school
Sixty-seven people were injured Friday, said Tauheed Zulfiqar, a representative of the Hayatabad Medical Complex in Peshawar.
The Pakistan Taliban attacked the mosque, spokesman Muhammad Khurasan said in an email to CNN, as revenge for the government's December 19 execution of a militant who was allied with the group.
Up to five attackers executed the assault, including a suicide bomber and someone who was shooting in the mosque, Nasir Khan Durrani, the city's police inspector general, told reporters. One would-be suicide bomber was stopped by people in the mosque who held him by the throat, Durrani said.
Pakistan has seen plenty of violence, much of it involving militants targeting restive regions in northwest Pakistan
along the border with Afghanistan.
It is the home base of the Pakistan Taliban, known as the Tehrik-e-Taliban Pakistan, or TTP, which seeks to enforce its conservative version of Islam in that nation. The group has battled Pakistani troops and attacked civilians, including in Peshawar, an ancient city of more than 3 million people.
Khurasan, the TTP spokesman, said the attack was orchestrated by TTP commander Kalifa Omar Mansoor. The militant group and the Pakistani army said previously that Mansoor commanded the December 16 massacre at the Army Public School and Degree College, which largely teaches sons and daughters of army personnel from around Peshawar.
In the school attack, gunmen burst in and gunned down children and staff, including in an auditorium filled with students taking exams.
Khurasan said Friday's mosque attack was revenge for the government's December 19 execution of Mohammed Aqeel, a man condemned in part for his role in an attack on an army headquarters in 2009. Aqeel was a member of a militant group allied with the TTP.