a day after a suicide bomber killed 38 people at a police funeral in the same city.
The shooting was a bloody start to the Eid festival, which marks the end of the holy fasting month of Ramadan -- marred in Pakistan this year by at least 11 attacks which killed more than 120 people.
"Four people opened fire when people were coming out of the mosque after saying Eid prayers, killing nine people and wounding 10 others," senior local police official, Bashir Ahmad Brohi, told AFP.
He said four people died at the scene while five others succumbed to their injuries in hospital.
Brohi said Ali Madad Jatak, a former provincial minister with the Pakistan Peoples Party which headed the last national coalition government, was also in the mosque and may been the target.
"But we are not sure at the moment and are investigating, " he said, adding that Jatak escaped unhurt although bullets hit his car.
People carry the body of a worshipper outside a hospital in Quetta following an attack by gunmen on a mosque. AFP photo
Another local police official, Sultan Ahmad, confirmed the incident and casualties outside the mosque, which is also a preaching and research centre.
There has been no claim of responsibility yet for the attack.
Quetta is the capital of Baluchistan, a vast, sparsely-populated southwestern province believed to have substantial oil and gas reserves.
People gather at a mosque after an attack by gunmen in Quetta. AFP photo
The city has been the focus of a surge in sectarian violence, mostly targeting the Shiite Muslim minority who make up around a fifth of Pakistan's mainly Sunni Muslim population.
The province also suffers from Islamist violence and a decade-long separatist insurgency by Baluch nationalists who want greater autonomy and a larger share of oil and gas revenues.
On Tuesday Baluch separatists shot dead 14 people including three security officials, 70 kilometres (44 miles) southeast of Quetta.
Elsewhere in the country, the United States evacuated all non-emergency staff from its consulate in the second largest city Lahore over a security threat.
Bystanders help an injured youth outside a hospital in Quetta following an attack by gunmen on a mosque. AFP photo