Spanish police on Friday detained the driver of a train that crashed in northwestern Spain, lowered the death toll from 80 to 78 and took possession of the “black boxes” of the train expected to shed light on why it was going faster than the speed limit on the curve where it derailed.

Police scientists examining the remains of those killed in Spain’s worst train crash in decades lowered the death count from 80 people to 78 on Friday and said the count could change as they continue their work identifying body parts and associating them with others.

Investigators, meanwhile, have taken possession of the “black boxes” of the train, which hurtled at high-speed along a curve and derailed, court spokeswoman Maria Pardo Rios said on Friday. The boxes record train’s trip data, including speed and distances and braking and are similar to flight recorders for airplanes.

The revised death toll came as forensic scientists matched body parts with each other at a makeshift morgue in Santiago de Compostela, in the north-western Galicia region, where the train crashed on Wednesday just as it was entering the outskirts of the city, said Antonio de Amo, the police chief in charge of the scientific service for Spain’s National Police.

Mr. De Amo said police are still working to identify what they believe are the remains of six people.

The driver, Francisco Jose Garzon Amo, was officially detained in the hospital where he was recovering, said Jaime Iglesias, the National Police chief of the Galicia region where the crash happened just on the outskirts of the regional capital, Santiago de Compostela.

Mr. Iglesias said that Mr. Garzon Amo would be questioned “as a suspect for a crime linked to the cause of the accident.”

The driver, under guard by police, cannot yet testify because of his medical condition, Mr. Iglesias said, adding that he did not have details of the medical condition but that it could delay efforts by police to question him.

The revised death toll from 80 to 78 came as forensic scientists matched body parts with each other at a makeshift morgue set up in a sports arena in Santiago de Compostela, said Antonio de Amo, the police chief in charge of the scientific service for Spain’s National Police.

Mr. De Amo said police are still working to identify what they believe are the remains of six people, and that the count could change as they continue their work associating body parts with each other.

Analysis will be performed on the boxes but she declined to comment on how long the analysis will take.

More In: International | News | World