Video has emerged of the horrific moment a train derailed in Spain's north-western Galicia region, killing at least 80 people.

The footage shows the eight-carriage train, operated by state rail company Renfe, entering a sharp bend at high speed near the city of Santiago de Compostela.

The train then careers off the tracks, smashing into a wall running alongside the rail as the carriages jack-knife and the engine overturns.

Key points: 247 people on board when train derailed

247 people on board when train derailed At least 78 people killed and over 100 injured

At least 78 people killed and over 100 injured Driver in custody and refusing to answer questions

Driver in custody and refusing to answer questions Memorial service for victims scheduled for Monday night (local time)

Memorial service for victims scheduled for Monday night (local time) Train said to have been travelling in excess of 80kph limit

Train said to have been travelling in excess of 80kph limit Railway firm president says train had perfect maintenance record

Railway firm president says train had perfect maintenance record Spanish PM declares three days of official mourning

The impact was so huge one carriage flew several metres into the air and landed on the other side of a high concrete barrier.

Around 94 people remain in hospital, 35 of them, including four children, in a serious condition, the deputy head of the regional government said.

Emergency workers at the site have now ended the search for survivors and bodies in the wreckage.

Police took the train driver, 52-year-old Francisco Jose Garzon, into custody in hospital on Thursday, following an order from the judge investigating the accident.

He is under formal investigation, according to the Galicia region supreme court.

The cause of the accident is not yet known, but it has been widely reported that the train was travelling well in excess of the 80 kilometres per hour speed limit when it crashed.

Train passed an inspection the morning of the crash

The president of railway firm Renfe, Julio Gomez Pomar-Rodriguez said the train had no technical problems and had passed an inspection that morning.

"What we know is that the train did not have any technical problems, the train had passed an inspection that same morning," Rodriguez told Cadena Cope radio station.

"To put it in another way, the maintenance record and monitoring of the train was perfect."

Representatives of railway unions said it was too early to tell whether the driver was to blame.

"Human error is always a possibility, and in defence of human error what do we have, we have technology, that is what it is for ... but it is very difficult to know what might have happened without, for example, hearing what the driver was saying at the time," said Miguel Angel Cillero, responsible for transport at union UGT.

Two investigations are being carried out - one a judicial probe and the other led by the Investigation Commission for Rail Accidents, which will be overseen by the transport ministry.

Canadian train manufacturer Bombardier has joined the investigation into the crash which involved one of its locomotives.

Marc Laforge, spokesman for the company's rail division, told AFP it had "dispatched people to the site to help in any way possible, and of course to collaborate with the investigation."

Bombardier was part of a consortium led by Spain's Patentes Talgo which won a contract in 2004 to supply Spain's national rail network Renfe with 44 high speed trains for 188 million euros.

Bombardier supplied the locomotives, capable of reaching speeds of up to 250kph, while Talgo supplied the chassis, brakes and other components.

"Of course, the locomotives were equipped with systems" that regulate speed, Mr Laforge noted, as a preliminary enquiry pointed to speed as the cause of the crash.

Prime minister declares three days of mourning

Prime minister Mariano Rajoy visited the Santiago de Compostela hospital, where most victims were taken, and declared three days of official mourning.

"I will sign a decree to declare three days of official mourning in all Spain," he said.

"I want to express on the behalf of myself and the Spanish government my condolences to all the families of the people who have died, of which unfortunately there are too many."

The president of the Galicia region, Alberto Nunez Feijoo, also announced a week of mourning over the tragedy, one of Europe's worst rail disasters.

"We heard a massive noise and we went down the tracks," Ricardo Martinez, a 47-year old baker from Santiago de Compostela, told Reuters.

"I helped getting a few injured and bodies out of the train. I went into one of the cars but I'd rather not tell you what I saw there."

Sorry, this video has expired Correspondent Philip Williams reports on the crash

The train derailed as the city prepared for the renowned festival of Saint James, when thousands of Christian pilgrims from across the world pack the streets.

The city's tourism board said all festivities, including the traditional High Mass at the centuries-old cathedral, had been cancelled as the city went into mourning following the crash.

King Juan Carlos and Crown Prince Felipe called off their public engagements for the day after the crash, in a sign of mourning for victims.

The King and his wife Queen Sofia have travelled to Santiago to visit grieving relatives and survivors.

"All Spaniards are feeling the pain of the families and hope the injured recover," he said. "We are united."

Maria Teresa Ramos was in her house when the train hurtled off the tracks.

"I heard something like a clap of thunder. It was very loud and there was lots of smoke. It's a disaster," the 62-year-old housewife told AFP.

"People were screaming. I saw a train on top of the siding. No one here has ever seen anything like this."

She and her friends ran for blankets and towels to help the survivors, while her neighbour Martin Rozas, 39, helped pull the wounded from the wreckage and laid blankets over the dead.

"It was like an earthquake," he said.

"I started helping pull people out. I saw about five people dead."

The Galicia derailment was one of the worst rail accidents in Europe in 25 years and comes less than a fortnight after six people died when a train came off the tracks and hit the platform at a station in central France.

In Austria in November 2000, 155 people were killed when a fire in a tunnel engulfed a funicular train packed with skiers.

In Montenegro in 2006, as many 46 people were killed and nearly 200 injured when a packed train derailed and plunged into a ravine outside the capital Podgorica.

In Spain in the same year, 41 people were killed when an underground train derailed and overturned in a tunnel just before entering the Jesus metro station in Valencia.

Rescuers work at the scene of the train crash near Santiago de Compostela ( Reuters: Oscar Corral )

ABC/Reuters/AFP