At least 19 people have been killed in the Pakistani city of Peshawar in a gun and bomb attack on a Shi'ite mosque, the latest sectarian violence to hit the country.

Radical Sunni Islamist groups often target mosques frequented by minority Shi'ites, whom they see as infidels.

Police said armed men broke into the mosque, where people were attending Friday prayers, and opened fire, following which three explosions were heard inside the building.

The Pakistani Taliban, who are fighting against the state to set up a hardline Sunni theocracy, claimed responsibility and said the attack was revenge for Pakistan's crackdown on militants following a December school massacre.

"Either Pakistan will become your graveyard, or God's law, sharia, will be implemented," Taliban commander Khaleefa Omar Mansoor said in a video in which he was flanked by three young militants clutching AK-47 assault rifles.

"This is the first in a series of revenge attacks ... Wait for the rest," Mansoor, who had earlier claimed responsibility for the December 16 school attack in which more than 150 people were killed, said in the video sent by email to reporters.

The style of the mosque attack was similar to that of the school attack, when gunmen arrived in a car, set it on fire, and broke into the building using a back entrance.

Eyewitness, Shahid Hussain said worshippers had just finished prayers when five or six men wearing military uniforms broke into the mosque and started shooting.

"We had no idea what was going on. One of the attackers then blew himself up and then there was huge smoke and dust all around," he said.

The attack came as Pakistan tries to adopt new measures to tackle militants following the school massacre, in which 134 children were among the dead.

The government has pledged to crack down on all militant groups, and has reintroduced the death penalty, set up military courts to speed convictions and widened its offensive in northwestern areas on the Afghan border where militants find refuge.