The explosion ripped through crowds of people gathered to commemorate the Ashura, an occassion to remember the sacrifice of Imam Hussain, the Grandson of the Prophet Mohammad.
"It was a suicide attack," interior ministry spokesman Brigadier Javed Cheema told AFP. "The bomber was 15 or 16-years-old and he blew himself up after entering the gate leading to the prayer hall."
Peshawar police Deputy Superintendent Zafarullah Khan said eight people were killed in the bombing.
Witnesses said the attacker opened fire with an assault rifle before detonating himself just inside the mosque in the mainly Sunni city near the Afghan border while more than 100 people were worshipping there.
"I saw a young man push the security men at the gate and then run in firing. Then there was a huge explosion and lots of smoke," Ghulam Abbas, an official at the mosque, told AFP.
"There were loud screams and there are body parts strewn around the gate. The electricity went out, dead bodies are inside and many people were injured," he added.
Pieces of human flesh were stuck to the ceiling and four walls, an AFP correspondent said. Shoes and caps littered the floor, while some bodies lying in the hall were covered in black Shiite flags of mourning.
"I was sitting inside the imambargah when there was a huge blast. I blacked out and when I regained consciousness they told me that my uncle was killed," said injured worshipper Mustapha Ali.
Another worshipper, Waqar Hussein, said the walls of the mosque were "splattered with blood and body parts."
"People were listening to a sermon when the man opened fire and then blew himself up. There were men, women and children inside, people were screaming," said Waqar Hussein, a worshipper.
After the attacks, worshippers staged angry protests and beat their chests in mourning.
A blast in the same area of Peshawar during Ashura last year killed the city's police chief and 13 other people.