Two systems of cameras and microphones will record events in the driver's cabin on long-distance trains capable of exceeding 160kph, including AVE, Avant and Alvia services.
The recordings will be protected in a crash-proof black box, similar to those used in aircraft, but would only be viewed in the event of an accident.
Spanish daily El Mundo reported that plans to extend the system to include the 5,000 trains of the Cercanias commuter, regional and medium-distance services would require a further investment of €80 million.
The black boxes are part of a package of measures being introduced as a result of an accident in July 2013 when an Alvia train crashed near the northern Spanish city of Santiago.
It was speeding around a curve on the express route between Madrid and the port city of Ferrol on the Galician coast when all eight of its carriages derailed, leaving 79 passengers dead and 170 wounded.
The driver of the train admitted to going too fast and being on his mobile phone at the time of the accident.
Mobile phone use by train drivers has since been limited to emergencies but they are reportedly unhappy with the new plans to fit security cameras.
They say that they are being singled out for blame and claim that the state of the track and signalling systems were also factors in the accident.
The judge investigating the accident has asked for further information on train and track safety.
Spain's Ministry of Works announced in January that it was introducing new qualification requirements and compulsory psychological testing for the profession.