The accident happened on a stretch of high-speed track about four kilometres (2.5 miles) from the main train station in Santiago de Compostela, 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.
Emergency services workers in red jackets tended to injured passengers lying on a patch of grass as ambulance sirens wailed in the background.
“There are bodies laying on the railway track. It’s a Dante-esque scene,” Alberto Nunez Feijoo, president of the regional government, told news radio Cadena Ser.
A municipal building was made available for psychological counselling and as a centre for providing information.
Carriages were lying across the tracks, some of them jammed alongside a concrete siding.
Prime Minister Mariano Rajoy, who is from Santiago de Compostela, was to visit the scene of the accident on Thursday.
“I want to express my affection and solidarity with the victims of the terrible train accident in Santiago,” he said in a Twitter message.
Pope Francis called for prayers for the victims.
He joins the families in their sorrow and calls for prayers … in this tragic event, Vatican spokesman Federico Lombardi told reporters during the pope’s visit to Rio de Janeiro.
“He joins the families in their sorrow and calls for prayers … in this tragic event,” Vatican spokesman Federico Lombardi told reporters during the pope’s visit to Rio de Janeiro.
The town hall of Santiago de Compostela called off planned concerts and firework displays that had been planned as part of the festivities in honour of its patron saint.
The disaster was one of the worst in the history of Spain’s rail network.
In 1944, hundreds were killed in a crash also between Madrid and Galicia.
In 1972, 77 people were killed in a derailment in Andalusia in the south.