The attacker tried to enter the Dargah Fatehpur in the Jhal Magsi district of Balochistan and detonated his explosives vest when he was stopped by the police at the main entrance, Deputy Commissioner Asadullah Kakar told the media.
Kakar said an assistant sub-inspector of police was killed while attempting to stop the suicide bomber from entering the shrine. Two other policemen were also injured.
No group claimed responsibility for the attack but the Taliban usually target shrines as they consider it un-Islamic.
Balochistan Home Minister Mir Sarfaraz Bugti told the media that 18 people including a police constable and three children were killed in the blast.
"The brave police constable stopped the suicide bomber from entering the shrine after which he blew himself up. If he had managed to enter the shrine there would be have been greater casualties," Bugti said.
The minister said that around 25 people were injured in the blast and they were shifted to different hospitals.
Dr Rukhsana Magsi at the Gandawah hospital in Jhal Magsi, about 400 kms east of Quetta, the capital of Baluchistan province, confirmed 15 bodies were brought to the hospital.
Rescue officials fear that the death toll could rise as the blast took place when there was a heavy rush of devotees who had gathered at the shrine to pay their respect.
Devotees gather at the shrine of the revered Sufi saint every Thursday to participate in a Sufi dance called dhamaal and prayers.
Bugti said the shrine was holding its annual Urs and hundreds of devotees from all over the country had come to the place to pay their respects.
A bomb attack on the same shrine killed 35 people in 2005.
The local administration declared an emergency at hospitals in Sibbi and Dera Murad Jamali.
Earlier, Balochistan government spokesperson Anwarul Haq Kakar said 13 people had been killed. "We have confirmed reports it was a suicide attack," he said.
Initial probe showed that the blast occurred when dhamal was going in the premises of the shrine.
Prime Minister Shahid Khaqan Abbasi condemned the attack and vowed that his government will act against terrorists with full might.
Thursday's attack is the second major strike at a shrine in Balochistan where in November 2016, at least 52 people were killed and 102 injured in a blast at the shrine of Shah Norani in Khuzdar district.
India is the 7th most terror affected country. Pakistan 4th
Defiant Pak rejects BRICS declaration on terrorist groups
US concerned over future government in Pak: Tillerson
Pak's ISI has connections with terror groups: US
Why US won't declare Pak a 'terrorist State'