The driver of the train that crashed near the Spanish city of Santiago de Compostela, killing 79 people, has been provisionally charged with multiple cases of reckless homicide.
A court statement said Francisco Jose Garzon Amo had been released but has surrendered his passport to a judge.
Mr Garzon had arrived at court in handcuffs to appear before the investigating judge.
He is suspected of driving too fast on a bend.
The court statement said Mr Garzon must appear before a court once a week and is not allowed to leave Spain without permission.
Reports say the train was travelling at more than double the speed limit at the time of the crash.
Mr Garzon, 52, was pictured being escorted away from the wreckage by police, blood pouring from a head injury.
He left hospital on Saturday and was immediately taken to the central police station in Santiago.
He had refused to make a statement or answer questions until now.
Spanish newspaper El Pais said Mr Garzon had admitted to "recklessness" in court.
On Sunday, an eyewitness to the disaster told the BBC that he had overheard the driver admitting minutes after the crash that he had been going too fast.
Evaristo Iglesias, a resident of Santiago de Compostela, said he heard the driver saying he tried to slow down but "it was too late".
Mr Iglesias said the driver, who was shocked and dazed, was repeatedly "saying he wanted to die" rather than see the damage at the scene.
Sunday's court hearing was held behind closed doors.
At least 130 people were injured in the accident. It emerged that one of them - identified as an American woman - died on Sunday.
Dozens more remain in a critical condition.
All eight carriages of the train - packed with more than 200 passengers - careered off the tracks into a concrete wall as they sped around the curve on the express route between Madrid and the port city of Ferrol on the Galician coast.
Leaking diesel burst into flames in some of the carriages.
The train's data recording "black box" is with the judge in charge of the investigation. Officials have so far not said how fast the train was going when it derailed.
Gonzalo Ferre, president of Spanish rail network administrator Adif, said the driver should have started slowing the train 4km (2.5 miles) before the spot where the accident happened.
The president of Spanish train operator Renfe, Julio Gomez Pomar, has said the train had no technical problems.
He said the driver had 30 years' experience with the company and had been operating trains on the line for more than a year.
People from several nationalities were among the injured, including five US citizens and one Briton. Two Americans were among the dead.
The crash was one of the worst rail disasters in Spanish history.