Petroleos de Mexico, the state oil company, said on Twitter that the blast was caused by an attempted theft of crude oil.
Five policemen and two firefighters were injured when they responded to the explosion and fire, the state of Mexico's secretary for security said.
Pemex said they got too close to the blaze and were injured in a secondary explosion.
Two patrol cars were incinerated by the fire.
The incident occurred in a corn field near the municipality of Tonanitla, about 40 kilometres from Mexico City.
In January, 37 people were killed at Pemex's Mexico City headquarters when an accumulation of gas in its basement ignited.
A Pemex gas distribution plant in the northern city of Reynosa exploded in September 2012, killing another 30 people.