At least 78 people have been killed in the passenger train derailment in north-western Spain on Wednesday.
More than 140 were hurt, 36 seriously, after all eight carriages of the Madrid to Ferrol train came off the tracks near Santiago de Compostela.
Media reports say the train may have been travelling at more than twice the speed limit around a curve.
Officials say one of the train's drivers has been put under formal investigation.
It is one of Spain's worst ever train crashes. PM Mariano Rajoy has declared three days of national mourning.
"Today is a very difficult day. Today we have lived through a terrible, dramatic accident, which I fear will stay with us for a long time.
"For someone from Santiago, like myself, believe me, this is the saddest Day of Saint James of my life."
Two investigations are being carried out - one judicial, the other by the investigative commission for rail accidents, under the Ministry of Public Works, Mr Rajoy added.
Mr Rajoy, who was born in Santiago de Compostela, has been visiting the scene of the accident.
"I want to express my affection and solidarity with the victims of the terrible train accident in Santiago," Mr Rajoy said earlier.
The black box of the train is now with the judge in charge of the investigation.
The president of railway firm Renfe, Julio Gomez Pomar, has said the train in the crash had no technical problems.
"The train had passed an inspection that same morning. Those trains are inspected every 7,500km... Its maintenance record was perfect," he told Spanish radio.
Spain generally has a relatively good record in terms of rail safety, says the BBC's Tom Burridge in Madrid.
This is a country which has invested huge amounts of money in its rail network, he says.
According to official figures, the crash is one of the worst rail disasters in Spanish history.
In 1972, a frontal train crash in Andalusia, in the south of the country, left dozens of people dead. The figures given at the time range between 76 and 86.
In 1944, hundreds of people were believed to have been killed in a crash in Torre del Bierzo, in Leon province - though the official account in days of heavy censorship under Gen Francisco Franco gave the figure as 78 killed.
Renfe said the train came off the tracks on a bend about 3 or 4km (2-2.5 miles) from Santiago de Compostela station at 20:41 local time (18:41 GMT) on Wednesday.
It was on the express route between the capital, Madrid, and the ship-building city of Ferrol on the Galician coast, with 218 passengers on board - in addition to an unknown number of crew members.
Firefighter Jaime Tizon, one of the first to reach the site of the crash, described the scene as "hell".
"I'm coming from hell, I couldn't tell you if the engine was on fire, or one of the carriages or what..." he told ABC after dragging the injured and bodies from the train.
Earlier, the leader of the regional government Alberto Nunez Feijoo described it as "a Dante-esque scene", in comments to Spanish radio.
One witness, Ricardo Montesco, described how the train carriages "piled on top of one another" after the train hit a curve.
"A lot of people were squashed on the bottom. We tried to squeeze out of the bottom of the wagons to get out and we realised the train was burning...I was in the second wagon and there was fire. I saw corpses," he told Spanish Cadena Ser radio station.
Several eyewitnesses described the train travelling very fast before it derailed.
Renfe says it and the track operating company Adif are collaborating with a judge appointed to investigate the accident.
One of the drivers who was trapped in the cab of the train after the accident is quoted as saying moments after the crash that the train had taken the curve at 190 km/h (118mph) when entering the curve, unidentified investigation sources have told Spanish media.
The speed limit on that section of track is 80km/h.
"I hope no one died because it will weigh on my conscience," he said.
UK Foreign Secretary William Hague has said one British citizen was known to have been injured in the accident.
The derailment happened on the eve of Santiago de Compostela's main annual festival where thousands of Christian pilgrims were expected to flock to the city in honour of Saint James.
The city's tourism board said all festivities planned for Thursday have been cancelled.
The driver of the train survived the crash. He is reported as saying the train was travelling at 190km/h - twice the speed limit - before the accident.
One of the carriages was forced into the air and landed on a side road next to the track. Watch the video to listen to eyewitnesses describe the aftermath of the crash.
Rear of train
The train was carrying 218 passengers. Middle and rear carriages twisted and piled on top of each other.