One of the drivers of a train which derailed in north-western Spain killing at least 80 passengers has been put under formal investigation, court officials have said.
Speed will be a factor in the inquiry, as a security camera captured the train crashing as it hurtled round a bend.
Dozens of people were hurt, 32 seriously, in the incident near Santiago de Compostela.
Video posted online appears to show the moment the train
derailed, from the trackside
Spain will hold three days of mourning over the crash, one of its worst.
King Juan Carlos visited survivors and the families of victims at Santiago's University Hospital.
"All Spaniards are united at this moment," he said.
Prime Minister Mariano Rajoy was at the scene of the crash earlier in the day.
The Madrid to Ferrol train's data recording "black box" is now with the judge in charge of the investigation.
'No technical problems'
At least 130 people were taken to hospital after the crash, and 95 are still being treated, health officials say.
The 32 seriously injured include children.
People from several nationalities are among the wounded, including five Americans and one Briton. One American was among the dead.
Dozens of people have been killed or injured after a train derailed in the Galicia region of Spain
A spokeswoman for the Galicia Supreme Court said the driver, who was slightly injured in the crash, was under investigation.
Named by Spanish media as Francisco Jose Garzon Amo, he is expected to face questioning by police on Thursday.
It was unclear whether anyone else was subject to investigation.
The train's carriages have been removed from the track by cranes and sent for analysis.
The president of railway firm Renfe, Julio Gomez Pomar, was quoted by El Mundo newspaper as saying the driver, who was aged 52, had 30 years of experience with the company and had been operating trains on the line for more than a year.
He said the train which derailed had no technical problems.
The website of Spanish daily ABC opens with the line
"Spain, in mourning" above a video of the mangled train.
National daily El Pais has headlined a quote attributed to
the train driver: "I'm going at 190!".
Regional daily La Voz de Galicia features a close-up of a
crying woman being comforted as she awaits news in
front of a hospital where the injured have been taken.
Radio station SER is starting its hourly bulletins with a clip
from the head of the regional government Alberto Nunez
Feijoo saying that "On its national day, the people of
Galicia are crying".
State broadcaster Radio Nacional de Espana is running
rolling coverage of the derailment and the first stages
of the investigation into its causes.
News and opinion website La Republica comments: "This
horrible event that has entirely shaken Spain adds to all
the personal and collective problems of the country's
economic and social crisis."
"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.
But Mr Garzon, who was trapped in the cab after the accident, is quoted as saying moments after the crash that the train had taken the curve at 190 km/h (118mph) despite a speed limit on that section of 80km/h, unidentified investigation sources have told Spanish media.
If this is the case, it remains to be seen whether a systems failure or driver error was the cause, correspondents say.
Spain has invested huge amounts of money in its rail network and has a relatively good safety record, says the BBC's Tom Burridge in Madrid.
Mr Rajoy, who was born in Santiago de Compostela, expressed sadness and shock as he visited the scene.
"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," he said.
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, left dozens of people dead. The figures given at the time ranged 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 during the early rule of Gen Francisco Franco gave the figure as 78 killed.
'I saw corpses'
Renfe said the train came off the tracks 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 port city of Ferrol on the Galician coast, with 218 passengers on board - in addition to an unknown number of staff and crew.
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 Spanish newspaper ABC after dragging the injured and bodies from the train.
One witness, Ricardo Montesco, described how the train carriages "piled on top of one another" after the train hit the 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.
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 St James.
The city's tourism board said all festivities planned for Thursday have been cancelled.