Around 1,300 people were stranded in Marseille, 1,700 in Toulon and 370 in Nice after the fire broke out in Aubagne, 20 kilometres (12 miles) east of Marseille, and ripped across the tracks, state railway company SNCF said.
About 10 trains were delayed for several hours on one of the busiest weekends of the year, when many holidaymakers return from the coast. Services between Nice and Paris -- which are sometimes routed through Marseille -- gradually resumed Sunday morning after the fire was brought under control.
With most hotels along the coast full, some of the stranded passengers spent the night on trains in the stations, where the SNCF provided them with food and drink.
Three firefighters and an elderly woman were slightly injured in the fire, the latest in a string of blazes that have consumed vast tracts of brush in southern Europe since the start of an exceptionally hot summer.
"We were afraid of cables melting or other damage after the fire crossed the tracks, but the good news is that the infrastructure was not damaged," a regional SNCF spokesman told AFP.