Sayed Qainul Hassan, who runs the community centre, said: "When they went out there was an explosion. It terrified us, the noise was deafening."
Kamal Hyder, Al Jazeera's correspondent in Pakistan, reported that a small explosion had occurred, bringing officials to the scene when there was a second, larger blast.
He said: "Security forces were already on high alert and the suspicion is that this was an organised sectarian attack, but we cannot confirm that at this time."
He said that no one had yet claimed responsibility for the blast, which comes just a few days before the Muslim feast of Ashura.
Fazal Wadood, an area police official, said ambulances were attending the scene.
He said most of the wounded were police who were providing security outside the mosque.
Mohammed Ali Durrani, Pakistan's information minister, condemned the attack, saying it had been orchestrated by the "enemies of Pakistan, Islam and humanity".
While Pakistani Shia and Sunni communities usually co-exist peacefully, groups on both sides are blamed for sectarian attacks.