The hole in the pipeline, operated by state-owned oil monopoly Petroleos Mexicanos, caused a plume of fuel to shoot into the air, bringing the risk of a fire or explosion, Spanish news agency EFE reported.
About 4,500 people were evacuated from the town of Tlajamulco near Guadalajara, but Pemex technicians and firefighters were able to stop the leak within a few hours.
Tlajomulco's mayor said rainfall prevented a fire from starting, the news agency said.
2014: NFL Cheerleaders [PHOTOS]
Migrant abuse claims bring German police probe