Mexico's state-owned oil company, Petroleos Mexicanos, initially reported 10 deaths at the facility near the city of Reynosa, across from McAllen, Texas. Later, the death toll was raised to 26, according to the company's Twitter account.
Pemex said in a statement that the fire had been extinguished and the pipeline was shut off. The pipeline carries natural gas from wells in the Burgos basin.
The company said through its Twitter account that four of those killed were Pemex employees and the rest were employed by contractors. It said officials were still investigating to determine the cause of the fire.
Civil protection officials said they evacuated ranches and homes within three miles (five kilometres) of the gas facility, which is about 12 miles (19 kilometres) southwest of Reynosa.
Authorities didn't say how many people were evacuated, but the area is sparsely populated, Tamaulipas state's civil protection director Pedro Benavides told a Televisa station.
The highway that connects Reynosa to the industrial city of Monterrey was closed to traffic, authorities said.
Pipelines carrying gasoline and diesel in Mexico are frequently tapped by thieves looking to steal fuel.
Several oil spills and explosions have been blamed on illegal taps. But thieves seldom target gas pipelines.
In December 2010, authorities blamed oil thieves for an oil pipeline explosion in a central Mexico city near the capital that killed 28 people, including 13 children. The blast burned people and scorched homes, affecting 5,000 residents in an area six miles (10 kilometres) wide in San Martin Texmelucan.Suggest a correction