Francisco Jose Garzon Amo
Train driver Francisco Jose Garzon Amo, is helped by a policeman after a train crashed near Santiago de Compostela (Reuters)

The driver of a train that derailed in Spain killing at least 78 people, reportedly told rescuers he wanted to die, after relaying the scale of the accident.

Spanish police have formally detained the driver Francisco Garzón, who is injured and under guard in hospital. He faces charges of "recklessness", according to police authorities.

"I have f***ed it up. I want to die," Garzón, 52, told rescuers that freed him from the crashed cockpit, El Mundo newspaper reported.

In another conversation Garzón was quoted as admitting to emergency services he was speeding as he entered a curved stretch of track, as the train was travelling at about 190kph, twice the speed limit.

"We are humans, we are humans", the driver was quoted as saying by El Pais newspaper. "I hope there are no fatalities as they weigh on my consciousness".

The transcripts of the conversations are reportedly being used by investigating authorities.

Garzón has worked for the state-owned train operator Renfe for about 30 years.

He is recovering at a Santiago hospital under police watch. The driver, from La Coruña in northwest Spain reportedly tested negative for alcohol.

Spanish Prime Minister Mariano Rajoy, who was born just a few miles from where the crash took place, visited the site of the accident and declared three days of national mourning.

More than 140 people were injured in the crash; 95 are still in hospital, 32 of them, including four children, in a serious condition.

In March 2012, Garzón posted a picture of him operating a train at high speeds on Facebook and bragging about it. A snap depicted a speedometer clocking 200kph.

"Woah you are going so fast, braaaaaaake," one of his friends commented.

Garzón replied: "If I went any faster, they'd fine me," adding: "The speedometer doesn't lie." The related Facebook account has been deactivated.