The Friday attack on a building used by the Ahmadiyya sect happened in the village of Mong, about 400km northeast of Multan, a main city in the eastern Punjab province, said Mohammed Arif, an area police officer.
The attack came after a dawn prayer on the second day of Ramadan.
"So far we only know that three men riding on a motorcycle suddenly came in the village on Friday morning. Two of them went inside the mosque and started firing," he said.
"It was a scene of carnage. The floor of the one-room mosque was littered with blood," said Mohammad Sajid, who lives nearby. He said 25 people were praying when the attack happened at around 4.45am (2345 GMT).
"We condemn this attack," Information Minister Sheikh Rashid said.
The Ahmadiyya sect was founded in 1889 by Mirza Ghulam Ahmad, a 19th-century Indian religious leader who claimed to be a prophet seeking Islam's renewal. The religious group differs from Muslims over the definition of Islam's founder Mohammad being the final prophet.
Sunni Muslim Pakistan passed a law in 1970s forbidding Ahmadiyyas from calling themselves Muslims.
Religious violence in Pakistan has claimed 4000 lives in the past decade, mainly through bomb blasts and targeted killings.
No one has yet claimed responsibility for the attack.