A train flew off the tracks as it reportedly tore at twice the speed limit around a bend in northwestern Spain, killing at least 78 passengers and injuring more than 140 in the nation's deadliest rail disaster since 1944.
Carriages piled into each other and overturned in Wednesday's crash, smoke billowing from the wreckage of mangled steel and smashed windows as bodies were laid out under blankets along the tracks.
State railway company Renfe said it was too early to determine the cause but several media outlets said the train carrying 218 passengers and four crew was speeding.
It came off the tracks on a curve at 8:42 pm (1842 GMT) on Wednesday as it was about to enter Santiago de Compostela station in the northwestern region of Galicia.
One of the drivers who became trapped in the cab after the accident told railway officials by radio shortly after the crash that the train had taken the bend at 190 kilometres (118 miles) an hour, unidentified investigation sources told El Pais newspaper.
The speed limit on that section of track is 80 kilometres an hour.
"I hope no one died because it will weigh on my conscience," he said, according to the paper's online edition.
The eight carriages derailed on a stretch of high-speed track about four kilometres from the station in the city, the destination of the famous El Camino de Santiago pilgrimage which has been followed by Christians since the Middle Ages.
The train was the Alvia model which is able to adapt between high-speed and normal tracks.
It had left Madrid and was heading for the coastal shipbuilding town of Ferrol as the Galicia region was preparing celebrations in honour of its patron saint James.
Prime Minister Mariano Rajoy, a native of Santiago de Compostela, visited the scene of the accident on Thursday and declared three days of mourning.
King Juan Carlos and Crown Prince Felipe called off their public engagements out of respect for the victims.
Several witnesses spoke of a loud explosion at the time of the crash.
"I was at home and I heard something like a clap of thunder, It was very loud and there was lots of smoke," said 62-year-old Maria Teresa Ramos, who lives just metres from the site.
"It's a disaster, people are crying out. Nobody has ever seen anything like this," she added.
Rescue workers recovered 73 bodies from the wreckage and four more victims died later in hospital, a spokesman for the Galicia high court said.
Provincial officials later said the death toll had risen to 78 while more than 140 people were injured.
It is the worst rail accident in Spain since 1944, when hundreds were killed in a train collision, also between Madrid and Galicia.
Renfe said the train had no technical problems and had just passed an inspection on the morning of the accident, adding that the cause was unknown.
"We will know what the speed is very soon when we consult the train's black box," a Renfe spokesman said.
Rajoy said two investigations were being carried out, one a judicial probe and the other led by the Investigation Comission for Rail Accidents, which will be overseen by the transport ministry.
"The objective is that we will know as soon as possible what were the causes of this accident," he said.
Francisco Otero, 39, who was inside his parents' home just beside the section of the track where the accident happened, said he "heard a huge bang".
"My neighbours tried to pull out people who were trapped inside the carriages with the help of pickaxes and sledgehammers and they eventually got them out with a hand saw. It was unreal," he told AFP.
The twisted, gutted shells of the white train carriages lay near a bend in the track on the outskirts of Santiago de Compostela. One was rammed into a concrete siding, another snapped like a branch over the top of a third. Bits of twisted metal from a fourth were scattered nearby.
The images of the wrecked carriages stirred memories of the 2004 Madrid train bombings by Islamic extremists which killed 191 people.
The town hall of Santiago de Compostela called off concerts and firework displays that had been planned as part of the festivities in honour of its patron saint.
Hundreds of local residents and tourists attended a nearly two-hour mass in the city's imposing cathedral to pray for the victims.
Pope Francis called for prayers, while France, Poland, Italy and the European Union sent their condolences.
The accident in Spain is the third large rail disaster this month after six people died in a passenger train derailment near Paris on July 12, and 47 were killed when an oil train derailed and exploded in Canada on July 6.