Railways came relatively late to Spain, the first line in the Peninsula to be built was a short line from Barcelona to Mataró opened in 1848. A line was already working, though, in Cuba, then part of the Spanish empire. It was not until laws were passed making railway investment attractive to foreign capital in the 1850s, that railway building on a large scale began.
One major misfortune, was a decision taken at an early stage, that Spain's railways would be built to an unusual broad track gauge of 1674 mm (roughly 5ft 6in, or six Castilian feet).
This decision was made for political reasons, due to the fact that during the 1850s Spain was hostile with neighboring France, and it was believed that making the Spanish railway network incompatible with the French one would hinder any French invasion. As a result, Portuguese railways also use a broad gauge.
Unfortunately this decision would be regretted by future generations, as it hindered international trade, and also made railway construction more expensive.
Due to the expense of building broad-gauge lines, a large system of narrow gauge railways were built in poorer parts of Spain especially in the north- west of the country.
The main line network was roughly complete by the 1870s.
Due to Spain's (until recently) relative lack of economic development, the Spanish railway network is quite small and thinly spread compared to most other European countries. For instance in terms of land area Spain is about 2.5 times larger than Britain but the mileage of its railway network is about 3,000 km (2,000 miles) smaller.
During the Spanish Civil War in the 1930s the railway network was extensively damaged. Immediately after winning the war Francoss regime nationalised the Broad gauge network, and in 1939 RENFE was formed, and narrow gauge lines were nationalised in the 1950s, later grouped in FEVE.
It took many years for the railway system to recover from the war, during the 1950s it was a common sight to see intercity express trains hauled by 100 year old steam locomotives on poor worn-out track.
In spite of this, innovators like Goicoechea created advanced trains like the Talgo and the TER.
Only since the end of Franco's regime, and the end of Spain's international isolation since the 1970s, has the Spanish railway network begun to modernise and catch up with the rest of Europe.
Following the decentralisation of Spain after 1978, the narrow-gauge lines that didn't cross the limits of autonomous communities of Spain have been spinned off FEVE and transferred to the regional government, which formed Eusko Trenbideak and Ferrocarrils de la Generalitat de Catalunya.
In recent years Spain's railways have received heavy investment, much of it coming from the European Union.
Most recently a standard-gauge high speed rail AVE line has been built between Madrid and Seville; in 2003 service was inaugurated from Madrid to Lleida, with an extension to Barcelona planned for 2005; this high speed system is set to be expanded in the future toward the Pyrenees. The Spanish governments have been frustrated, though, in 2003, when the French government announced a delay in plans to bring the TGV to the Spanish border. Further high-speed links are in construction from Madrid to Valladolid, and are planned for Valencia and Lisbon.
See also Transportation in Spain, Basque Y.