Spain's King Juan Carlos visits injured train survivors
King Juan Carlos has said all Spanish people feel the pain of the families of the 80 people killed in a high-speed train crash in north-western Spain.
The king was speaking on a visit to the dozens of hospitalised survivors in Santiago de Compostela, near to where the train derailed on Wednesday night.
PM Mariano Rajoy, who hails from the city of the crash, declared three days of official mourning on Thursday.
One of the train drivers is under formal investigation, officials say.
The driver, named by Spanish media as Francisco Jose Garzon Amo, was lightly injured and will be questioned by police in hospital, the Galicia Supreme Court said in a statement.
Spain's national train operator Renfe said it was too early to say what caused the train to derail. However, survivor accounts and media reports suggest the train was travelling at excessive speed as it hit a curve in the track .
Footage captured by a security camera shows the train crashing as it hurtled round a bend.
'The saddest day'
King Juan Carlos and his wife Queen Sofia visited survivors and the families of victims at Santiago's University Hospital on Thursday.
"All Spanish people join in the sorrow of the relatives of the deceased," he said, praising what he called the spirit of citizenship shown by rescue workers and blood donors.
Prime Minister Mariano Rajoy was at the scene of the crash on Thursday.
"For a native of Santiago like me, this is the saddest day," he said.
At least 130 people were taken to hospital after the crash, and 94 are still being treated, health officials say.
Thirty-two people are seriously injured, including children.
People from several nationalities are among the wounded, including five Americans and one Briton. One American was among the dead.
The Madrid to Ferrol train's data recording "black box" is now with the judge in charge of the investigation.
Meanwhile, 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 this line for more than a year.
He said the train which derailed 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.
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 (120mph) despite a speed limit on that section of 80km/h.
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.
According to official figures, the crash is one of the worst rail disasters in Spanish history.
Renfe said the train came off the tracks a few kilometres before 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.
Witnesses to the crash described seeing carriages "piled on top of one another" after the train hit a curve.
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 local tourism board cancelled all festivities as the city went into mourning.