The blast hit near the checkpoint at the Wagah border crossing, near Lahore.
The Pakistani Taliban said it had carried out the attack, although other militant groups - including Jundullah - also said they were responsible.
At least 15 people were badly injured, and officials said three members of the Pakistani border force had died.
The Wagah crossing is a high-profile target, with large crowds gathering every day to watch an elaborate flag-lowering ceremony as the border closes.
Mushtaq Sukhera, the Punjab police chief, told the Reuters news agency that the blast had happened when a suicide attacker approached a restaurant after the day's ceremony.
One witness, an intelligence official, said he was sitting in his office when he heard the blast.
"I rushed to the scene and saw scattered bodies, injured men, women and children and smashed cars," the official told Reuters.
Pakistani opposition politician Imran Khan described the blast as an "act of terror".
"Shocked and saddened by suicide attack nr Wagah border," the former international cricketer tweeted.
Meanwhile Indian Prime Minister Narendra Modi condemned the attack as a "dastardly act of terrorism".
India has in the past accused Pakistan of sponsoring jihadi groups in the region.
The two countries, which have fought three wars against each other, have been engaged in a long-running conflict over the region of Kashmir, which both sides claim.
An Indian security official said the Indian side of the border was not affected by the explosion, Reuters reported.
Dozens of people use the Wagah crossing to enter India and Pakistan every day, says the BBC's Shumaila Jaffrey in Lahore, as it is the only road crossing between the two countries.
It is also a crucial trade facility, where truck-loads of goods coming from and going to India are loaded and unloaded.
A large number of people attend the border parade on Sundays, our reporter adds.
Pakistan's government has been engaged in a long-running conflict with the Pakistani Taliban, or TTP.
The TTP announced a month-long ceasefire in March aimed at reviving peace talks with the government. But after the ceasefire ended in April the Pakistani army launched an offensive in the group's heartland in North Waziristan.