The worshippers had been called to visit the holy site by its custodian who, along with several accomplices, then attacked them, according to authorities.
“As they kept arriving, they were torturing and murdering them,” said deputy commissioner Liaqat Ali Chattha.
Most of the victims were hit on the back of the head in the incident in Sargodha, Punjab province.
The 50-year-old custodian, Abdul Waheed, was arrested and has confessed to the murders, claiming he feared the victims had wanted to kill him, said regional police chief Zulfiqar Hameed.
Mr Hameed said the suspect appeared to be mentally unstable but another motive could be rivalry for control of the shrine.
Local police station chief Shamshir Joya said the victims, whose clothes were torn and bloodstained, appeared to have been given intoxicants.
He added: “We suspect that the victims had been given some intoxicants before they were murdered, but we will wait for a forensics report to confirm this suspicion.”
A doctor at a Sargodha hospital, Pervaiz Haider, said: “There are bruises and wounds inflicted by a club and dagger on the bodies of victims.”
Four people were wounded in the incident.
A woman who had managed to escape alerted police and officers rushed to the scene where they arrested Waheed and several other people believed to be his accomplices.
Mr Joya said the shrine was built about two-and-a-half years ago and when its former custodian died, Waheed, who was once an employee of the national election commission, took over.