ISLAMABAD, Pakistan — An oil tanker caught fire and exploded after overturning on a road in eastern Pakistan on Sunday, killing at least 140 people and seriously injuring at least 50 more after they rushed toward the vehicle in an effort to collect fuel as it gushed from the tanker.

The authorities were investigating what caused the oil tanker to overturn and create an inferno, although one official suggested that it was probably caused by an engine spark.

The tanker overturned in Ahmedpur East, a small city in Punjab Province, as it was traveling from the southern port city of Karachi to Lahore, the province’s capital. It was believed to be carrying 5,500 gallons of oil, officials and the state-run news media reported.

Local television networks broadcast images of dozens of people collecting the fuel in bottles and buckets before the site turned into a giant fireball, and thick plumes of smoke enveloped the area after the explosion.

“We kept on telling people to leave the crash site, but people won’t listen and more kept coming,” said Muhammad Rizwan, a police official. “We knew it was dangerous, and if there were more cars and bikes, the casualties would have been much higher.”

Prime Minister Nawaz Sharif, who was in London on a private visit, cut short his stay and was returning to Pakistan, officials said. The explosion left most of the bodies charred beyond recognition. At least 73 motorbikes and several cars were also destroyed.

The injured were taken to the district hospital and Victoria Hospital in neighboring Bahawalpur, but the response was hindered by a shortage of facilities to treat burn victims. Arrangements were being made to take the seriously injured to a hospital in Multan, about 80 miles to the north, which has a burn-treatment unit. The Pakistan Army said it had sent two helicopters to help with the rescue efforts.

Abdul Rashid, 30, one of those injured, said he and his friend had joined in collecting the spilled fuel after passing by the area and seeing people trying to scoop it up from the overturned tanker.

“I parked my bike by the road and waited while my friend went to collect the fuel,” said Mr. Rashid, who had burns on his hand and a leg. “We did not have any bottles, so we asked people and got one. The bottle was small, so my friend went thrice to collect the fuel.”

He said he did know what had happened to his friend after the fire broke out.

There were no immediate information about why the tanker had overturned: speeding at a sharp turn, a burst tire or something else.

Muhammad Shehbaz Sharif, the chief minister of Punjab, expressed his grief over the loss of life, said an aide, Salman Sufi.

“The chief minister is monitoring the situation and has directed the authorities to provide the best medical facilities to the injured,” Mr. Sufi said. “The fire was started most likely by an engine spark causing fuel tanker to explode. The exact nature of the explosion is being investigated.”

Mr. Sufi said the driver of the tanker had escaped serious injury because the crash had taken place “long before” the explosion.

Imran Khan, the country’s most prominent opposition politicians, called the accident “a national tragedy of epic proportions.”