Three firefighters were injured on Wednesday north of Valencia city, the day after a train driver took evasive action to avoid the flames. 10 passengers were hurt in the panic.
"Run, run, run, run!" The cry rang out across the hillside as a wall of flame fed by high winds swept down towards four Spanish firefighters.
Seconds after they fled for their lives, the fire engulfed the tinder-dry bracken.
The firefighters' brush with death happened on Wednesday afternoon in the eastern Valencia region. Three firefighters were injured by flames and several villages in the area were evacuated, local emergency services said on Twitter.
Emergency crews had been trying to prevent flames from reaching a village in the municipality of Bejís, north of Valencia city.
The government of Castellón province tweeted a video early on Wednesday of firefighters running for their lives as towering flames from the Bejís fire roared behind them.
The same fire threatened to overwhelm a train on Tuesday night, causing the driver to take evasive action to try to avoid the flames. Spanish state news agency Efe reported that ten passengers were injured.
Authorities said on Wednesday that several passengers were injured when they panicked and got off rather than wait, as the flames approached the tracks.
The driver stopped and managed to reverse the train, which had been bound for Zaragoza, and return safely to Valencia city station.
The wildfire is one of two still raging out of control in eastern Spain.
South of Valencia city, a fire around the Val d’Ebo area has burnt 11,500 hectares and forced more than 1,500 people to evacuate towns and villages since the weekend.
The region’s emergency services tweeted Wednesday afternoon that nearly 10,000 hectares have been burned in the Bejís fire and 1,500 people moved from their homes.
Valencia regional president Ximo Puig said earlier that the Bejís fire had a perimeter of some 50 kilometres and the Val d’Ebo blaze had a perimeter of 80 kilometres.
The European Forest Fire Information System says 275,000 hectares have burned in wildfires so far this year in Spain. That’s more than four times the country’s annual average of 67,000 hectares since 2006, when records began.
In neighbouring Portugal, authorities said they hoped to bring under control a wildfire that has burned for 12 days and burnt large swaths of pine forest in the Serra da Estrela Natural Park.
However, officials warned a new heat wave forecast for the area could complicate the task.
Smoke from the Portuguese fire reached Spain's capital Madrid, several hundred kilometres to the east, on Tuesday.