Fuel thieves had drilled into the pipeline, causing the leak in the small town, according to state oil company Petroleos Mexicanos, or Pennex.
The priority, he said, was to eradicate the social problems and lack of opportunities that had prompted people to put their lives at risk to get at the fuel - a few liters of which are worth more than the daily minimum wage in Mexico.
Fuel theft gangs have hit back, winning the loyalty of impoverished neighbourhoods with the promise of free gasoline and getting local residents to act as lookouts and confront military patrols.
Hidalgo state governor, Omar Fayad, has warned the number of casualties may rise as further searches are carried out.
"I urge the entire population not to be complicit in fuel theft", Fayad said on Twitter.
The incident occurred in Tlahuelilpan, a city in the central Mexican state of Hidalgo, some 120 kms south of Mexico, the capital.
Video taken before the fire showed the oil spouting metres into the air as people approached with buckets at about 5pm local time (11pm GMT).
Cutting back on red meat 'will save the planet'
And researchers have warned that we can no longer feed our population a healthy diet while balancing planetary resources. It would also reduce the damaging effects of climate change, soil erosion, deforestation and loss of biodiversity.
Initial reports had said that at least 21 died in the blast.
The fire resulting from the pipeline explosion has been extinguished, Mexican Secretary of Public Security Alfonso Durazo said on Twitter, and rescue teams have begun to recover bodies.
In an early morning press conference on Saturday, Mr Lopez Obrador vowed to continue the fight against the billion-dollar illegal fuel theft industry.
He launched the offensive after taking office December 1, deploying 3,200 marines to guard pipelines and refineries. They were transported to local hospitals, he said.
"A lot of people arrived with their jerry cans, because of the gasoline shortages we've had", resident Martin Trejo told AFP as he looked for his son who had gone to collect fuel.
Mexican President Andrés Manuel López Obrador tweeted that he was briefed on the explosion. "What happened today in Tlahuelilpan should not be repeated", he said.
The crackdown involved state oil firm Pemex changing its distribution mechanism, triggering fuel shortages, empty petrol stations and long lines of angry motorists.