The state-owned oil company Pemex said none of the injuries were life-threatening.
Television and social media footage showed a huge column of flames and thick black smoke pouring from one part of the refinery complex.
The refinery's operations had been suspended yesterday because of heavy rains from former Tropical Storm Calvin, which had partly flooded some parts of the plant.
The company said the fire broke out after the floodwaters caused waste containment ponds to overflow, spreading oil around the plant.
Pemex said in a statement that the spilled oil "reached a point of ignition as a result of the flooding, sparking a fire."
The facility is located in Salina Cruz in the southern state of Oaxaca.