Witnesses described being knocked to the ground by the blast just after 8:00 am local time, then a "horrible scene" of blood and bodies and the sound of crying. Security forces cordoned off the area on Bedian Road in the bustling capital of Punjab province.
The attack, which the military confirmed was a suicide blast and was quickly claimed by the Pakistani Taliban, was the latest incident to dent growing confidence in security as Pakistan wages a years-long war on militancy.
Farhan Aslam, who was wounded in the explosion, said he and his father had been knocked from their bicycle.
"I saw two dead bodies on the spot and others crying," the student told AFP from hospital, where local officials were giving flowers to the wounded as a crowd gathered outside.
Punjab health minister Khawaja Imran Nazir said five people had been killed. Three of them were soldiers and two were civilians, a security source told AFP. Rescuers said at least 18 were wounded, including a child who was in critical condition.
The bomber had attacked a van carrying military personnel who were part of a team carrying out a census count, the Pakistan Board of Statistics confirmed.
Teams of enumerators backed by the military and security forces are carrying out Pakistan's first census in almost two decades, an enormous and highly-charged task that could redraw the country's political map one year before national parliamentary elections.
"The census is a national duty, and we will complete this task," Lahore official Abdullah Sumbal said.
"There was no lack of security, but you know how difficult it is to deal with suicide attacks."
Pakistan unnerved
The umbrella Pakistani Taliban, or Tehreek-e-Taliban Pakistan (TTP), in its statement said it had carried out the attack in revenge on security forces. The country's president and head of its powerful military condemned the blast.
Lahore has been on edge since a wave of violent attacks across Pakistan in February killed 130 people, including a bomb blast in the eastern city on February 13 which killed 14.
Ten days later a fresh blast killed eight people and sent panic through the city, though officials later said it was a gas leak, not an attack as initially feared.
February's series of assaults also included a suicide blast at a Sufi shrine in Sindh province which killed 90 people and was claimed by Islamic State.
At least 22 people were killed and 57 wounded on March 31, when a car bomb tore through a market in a mainly Shiite area of Pakistan's tribal belt in an attack that was also claimed by the TTP.
The surge in violence has shaken a growing sense of security after the country appeared to be making strong gains in its decade-and-a-half long fight against extremism, with analysts speaking of a militant resurgence.
The military launched a nationwide crackdown after February's attacks, killing dozens of alleged militants across the country.
Islamabad also swiftly accused neighbour Afghanistan of harbouring militants responsible for the attacks, and temporarily closed the border between the two countries.
Kabul has long accused Pakistan of sheltering the Afghan Taliban, a charge which Islamabad has at times admitted to.