A Spanish train that hurtled off the rails and smashed into a security wall as it rounded a bend was going so fast that carriages tumbled off the tracks like dominos, according to eyewitnesses and video footage.

The official death toll from last night's crash near the Christian festival city of Santiago de Compostela in northwest Spain, rose to 78 in the country's deadliest crash in four decades.

Hospital officials said 141 people were injured, and 36 remained in critical condition, among them four children.

Prime Minister Mariano Rajoy, who was born in Santiago de Compostela, toured the crash scene alongside rescue workers and went to a nearby hospital to visit some of the wounded and their families.

"For a native of Santiago, like me, this is the saddest day," Mr Rajoy said. He said judicial authorities and the Public Works Ministry had launched parallel investigations into what caused the crash.

Eyewitness accounts backed by security-camera footage of the moment of disaster suggested that the eight-carriage train carrying 218 passengers was going too fast as it tried to turn left underneath a road bridge. The speed limit on that section of track is 80 kilometres per hour, Spanish officials said.

The footage, which the Spanish railway authority Adif said probably came from one of its cameras, shows the train carriages start to buckle soon into the turn, with the first and second passenger carriages leaving the tracks first. The engine itself quickly follows, violently tipping on to its right side as it crashes into a concrete security wall and bulldozes its way along the ground.

In the background, all the rear carriages can be seen starting to decouple and come off the tracks. The picture goes blank as the engine appears to crash directly into the camera.

"I saw the train coming out of the bend at great speed and then there was a big noise," one eyewitness, Consuelo Domingues, told The Associated Press. "... Then everybody tried to get out of the train."

Santiago officials, who had been preparing for the city's annual Catholic festival, cancelled it and took control of the main sports stadium to use as a makeshift morgue. There, relatives of many of the dead could be seen sobbing and embracing each other.

Maria Pardo Rios, spokeswoman for the Galicia region's main court, said 73 people died at the scene, four others after they were taken to hospitals. The Interior Ministry later confirmed a 78th death.

A regional Galicia health official, Rocio Mosquera, told reporters that 95 people remained in hospital, among them 36 in critical condition, including four children.

The Interior Ministry, responsible for law and order, ruled out terrorism as a cause.

It was Spain's deadliest train accident since 1972, when a train collided with a bus in southwest Spain, killing 86 people and injuring 112.

"July 24 will no longer be the eve of a day of celebration but rather one commemorating one of the saddest days in the history of Galicia," said Alberto Nunez Feijoo, regional president of Galicia. Santiago de Compostela is its capital.

The accident created a scene that was "Dante-esque," Mr Feijoo said. He declared seven days of mourning for the victims.

Rescue workers spent the night searching through smashed carriages alongside the tracks.

As dawn broke, cranes brought to the scene were used to lift the carriages off the tracks. Rescue workers collected passengers' scattered luggage and loaded it into a truck next to the tracks.

Rescuers described a scene of horror immediately after the crash. Smoke billowed from at least one carriage that had caught fire, while another had been torn into two parts.

Residents of the residential neighbourhood closest to the rail line struggled to help victims out of the toppled cars. Some passengers were pulled out of broken windows. Television images showed one man atop a carriage lying on its side, using a pickaxe to try to smash through a window. Other rescuers used rocks to try to free survivors from the fiery wreckage.

Nearby, rescue workers lined up bodies covered in blankets alongside the tracks.

State-owned train operator Renfe said it couldn't confirm how many staff were on board the train. It said the crash happened at 8.41 pm 4 kms south of Santiago de Compostela.

Spanish media said the train had two drivers aboard and both survived.

Renfe said it and Adif, another state-owned company that manages tracks, signals and other railway infrastructure, were cooperating with a judge appointed to investigate the accident.

It was the world's third major rail accident this month.

On July 12, six people were killed and nearly 200 were injured when four cars of a passenger train derailed south of Paris.

On July 6, 72 cars carrying crude oil derailed in Lac-Megantic, Ontario, setting off explosions and fires that killed 47 people.

Catholic pilgrims converge on Santiago de Compostela annually to celebrate a festival honouring St James, a disciple of Jesus whose remains are said to rest in a shrine. The city is the main gathering point for those who reach the end of the El Camino de Santiago pilgrimage route that has drawn Christians since the Middle Ages.

Several injured passengers said they felt a strong vibration just before the cars jumped the tracks, according to Xabier Martinez, a photographer who talked with them after arriving at the scene as rescue workers were still removing bodies.

One passenger, Ricardo Montero, told the Cadena Ser radio station that "when the train reached that bend it began to flip over, many times, with some carriages ending up on top of others, leaving many people trapped below. We had to get under the carriages to get out."

Another passenger, Sergio Prego, told Cadena Ser the train "travelled very fast" just before it derailed and the cars flipped upside down, on their sides and into the air.

"I've been very lucky because I'm one of the few able to walk out," he said.

The Alvia 730 series train started from Madrid and was scheduled to end its journey at El Ferrol, about 95 kms north of Santiago de Compostela. Alvias operate high-speed services but do not go as fast as Spain's fastest bullet trains, called AVEs.

The maximum Alvia speed is 250 kph on tracks made especially for the AVEs, and they travel at a maximum speed of 220 kph on normal gauge rails.

Other major train crashes in Spain include a 1944 accident involving three trains that crashed in a tunnel. That disaster produced wildly disputed death tolls ranging from the government's official count of 78 to more than 500, according to later research.

In 2006, 43 people died when a subway train crashed because of excessive speed in the southern city of Valencia. In 2004, 191 died when al Qaida-inspired terrorists detonated 10 bombs on four Madrid commuter trains.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.