"A large number of people were returning after watching Rangers flag ceremony at Wagah border when a suicide bomber blew himself up near one of the exit gates," Inspector General Police of Punjab Police Mushtaq Sukhera said. He said three Pakistani Rangers were also among the dead.
Officials said that it was a suicide attack and at least 55 people, including women, children and security personnel, had been killed and 200 had sustained injuries.
In the wake of Muharram, the police had made strict security arrangements.
"The Rangers had made stringent security measures but it was difficult to check suicide bomber," said Sukhera.
"We had reports that some banned outfits might target Shias, religious personalities, public processions and important buildings."
He said: "It appears that he (the bomber) is a young man of 20-25 years. At least 15 to 20 kilogramme explosives have been used in the blast, showing some of the explosives was in his suicide jacket and remaining he might have carried."
Punjab Rangers Director General Khan Tahir Khan said: "The suicide bomber failing to enter the main gate leading to the parade lane blew himself up 500 to 600 metres away...Three rangers personnel present at the main gate have been killed while five others suffered critical injuries."
Al-Qaeda affiliated militant group Jandullah, which was behind a suicide bombing that killed at least 78 Christians at a church in Peshawar in September 2013, claimed responsibility for the attack.
The spokesman of the splinter group of the Tehreek-i- Taliban Pakistan (TTP)Ahmed Marwat said the attack was a reaction to Pakistani military's operation Zarb-i-Azb and Waziristan operation against insurgents.
But another militant faction Jamat-ul-Ahrar, which broke away from the main TTP leadership in September, rubbished the claim and said they were behind the blast.
Huge crowds gather every evening at the Wagah crossing, 22 kilometres from Lahore, to watch a "lowering of the flags" ceremony and witness the display of military pageantry that accompanies the formal closing of the border post which soldiers from both countries have conducted for decades.
Sukhera said the bomber was stopped at the gate of the parade ground at the border and detonated the bomb right when people gathered near the gate.
"The bomb exploded outside a restaurant near a Pakistani paramilitary soldiers' checkpoint at Wagah border," he added.
"People were returning after watching the parade at Wagah border when the blast took place. Ball bearings were found at the scene," another police official said.
Prime Minister Nawaz Sharif expressed "grief and sorrow" and condemned the blast. He ordered authorities to provide best medical assistance to the injured.
Defence Minister Khawaja Muhammad Asif expressed the government's resolve to fight terrorism in the country. In a statement, he said the terrorists cannot dent the resolve of the nation to fight terrorism, Radio Pakistan reported.
The government has also announced Rs500,000 to the kin of those killed and Rs75,000 for the kin of those injured.
Imdad Husain, an eyewitness, told reporters that he was returning after watching the parade ceremony when he heard a bang near the Wagah border market.
"I fell unconscious. When I gained consciousness there had been complete darkness. Many injured and I cried for help lying on the road. After 15 minutes some rescue men came towards me and shifted me to the Ghurki Hospital, a border area health facility," he said.
Samina Bibi was also returning along with her husband and two young children when the blast took place. On the bed of the Ghurki Hospital she was crying and asking the doctors about her husband and children. "The doctors were comforting her saying they are alright," Imdad said.
There were two families who lost eight and five of their members respectively in the attack.
Emergency has been declared at all hospitals in Lahore.
"The death toll may rise as the condition of some seven or so patients is still critical. We are trying our best to safe these patients including a four-year-old girl," senior doctor at Ghurki hospital Khurram Shahzad told PTI.
Punjab Emergency Services Rescue 1122 spokesman Jam Sajjad told PTI that he feared rise in the death toll.
"We have shifted about 200 injured in different hospitals of Lahore," he said. He said the condition of over a dozen is critical.
There were conflicting claims of responsibility for the attack, reflecting the divison within the umbrella group TTP.
Abdullah Bahar, a spokesman for a TTP faction loyal to its dead chief Hakimullah Mehsud, said they carried it out to avenge Mehsud's killing in a US drone strike last year.
Pakistan has been hit by a homegrown Taliban insurgency that has left thousands of people dead in the past decade.
In June, the army began an operation against militant hideouts in the North Waziristan tribal region, after a bloody attack on Karachi airport ended fledgling peace talks between the government and the Pakistani Taliban.
The military says over 1,100 militants and 100 soldiers have been killed since the start of Operation Zarb-e-Azb while more than 100 militants have surrendered.