Rail transport in Spain

Rail transport in Spain operates on four rail gauges and services are operated by a variety of private and public operators. The total route length in 2012 was 16,026 km (10,182 km electrified).

Most railways are operated by Renfe; metre and narrow-gauge lines are operated by FEVE and other carriers in individual autonomous communities. It is proposed and planned to build or convert more lines to standard gauge, including some dual gauging of broad-gauge lines, especially where these lines link to France, including platforms to be raised.

Spain is a member of the International Union of Railways (UIC). The UIC Country Code for Spain is 71.

History
The first railway line in the Iberian Peninsula was built in 1848 between Barcelona and Mataró. In 1851 the Madrid-Aranjuez line was opened. In 1852 the first narrow gauge line was built; in 1863 a line reached the Portuguese border. By 1864 the Madrid-Irún line had been opened, and the French border reached.

In 1900 the first line to be electrified was La Poveda-Madrid.

After the Spanish Civil War, the Spanish railway system was in a state of disrepair due to the damage caused by the conflict. In 1941 RENFE was created by nationalizing the private companies that had built and until then operated the network, leading to a state-owned rail network.

By the 1950s, the Spanish rail network reached its historical maximum of almost 19,000 kilometers. However, from the mid-1950s onward, the network began to shrink due to the exponential increase in private vehicle ownership in Spain. During the Spanish economic miracle of the 1950s and 1960s, the number of private vehicles in Spain increased more than 14 times from the mid-1940s to the mid-1960s. This led to a decline in demand for rail transport and the closure of some rail lines that were no longer profitable. By 1993, almost 8,000 km of rail lines were dismantled.

The last steam locomotive was withdrawn in 1975, and in 1986 the maximum speed on the railways was raised to 160 km/h, and in 1992 the Madrid-Seville high-speed line opened, beginning the process of building a nationwide high-speed network known as AVE (Alta Velocidad España).

The current plans of the Spanish government are to finish the standard-gauge high-speed network by building new sections of track and upgrading and converting to standard gauge the existing line along the Mediterranean coast connecting the ports of Barcelona, Tarragona, Valencia, Cartagena and Almería, to link Madrid with Vigo, Santiago and A Coruña in Galicia, to extend the Madrid-Valladolid line to Burgos and the Basque cities of Bilbao and San Sebastián, and to Hendaye on the French border, as well as to link Madrid with Lisbon and the port of Sines through Badajoz. Former plans by the Popular Party government under Prime Minister Aznar to link all provincial capitals with high-speed rail have been shelved as unrealistic, unaffordable, and contrary to all economic logic as no European funding would be made available for such projects.

Following the opening of the AVE network, the classic Iberian gauge railways have lost importance in inter-city travel, for example, the Madrid–Barcelona railway takes over nine hours to travel between the two cities stopping at every station. With the Madrid–Barcelona high-speed rail line, the longest possible journey is just three hours. This has allowed the conventional lines to increase focus on regional and commuter traffic, along with freight. Some lines, including the Córdoba-Bobadilla section of the classic Córdoba–Málaga railway, have lost passenger traffic completely due to the opening of AVE serving the same destinations.

Many important mainland Spanish towns remain disconnected from the rail network, the largest being Marbella with a population of over 140,000, along with Roquetas de Mar (pop. 96,800), El Ejido (pop. 84,000), Torrevieja (pop. 83,000) and Mijas (pop. 82,000). Other towns and municipalities are not on the national rail network but linked to light rail or metro systems, such as Santa Coloma de Gramanet, Barcelona (pop. 118,000); Chiclana de la Frontera, Cádiz (pop. 83,000); Torrent, Valencia (pop. 83,000); Getxo, Biscay (pop. 78,000); and Benidorm, Alicante (pop. 70,000).

Starting in Franco's regime and continuing into the 1980s, multiple lines of the Spanish rail network were closed. Campaigns for reopening former lines exist, including a reopening the branch to the aforementioned Torrevieja from the Alicante–Murcia main line; the former line from Guadix to Lorca via Baza (which would provide a direct rail link from Murcia to Granada); Plasencia to Salamanca and Gandía to Dénia.

Since 2007 the operation of freight lines was liberalized and has been open to private operators. Renfe was split in two companies (Renfe, a public company that operates freight and passenger lines, and ADIF, a public company that manages the infrastructure for all public and private operators).

In 2020, long-distance passenger lines were likewise opened to private operators. Ouigo España began service on the Madrid–Barcelona route in 2021, joined by Iryo in 2022.

From 1 September to 31 December 2022 Spain has made free train tickets available under certain conditions. A €10 to €20 deposit must be placed and the scheme is only available on multi-trip tickets or season tickets, rather than singles. 16 or more train journeys must be made between the aforementioned dates in order to receive a full refund. The full refund is available on commuter journeys and medium-distance journeys of under 300 km (186 miles). The initiative is being funded through a windfall tax on banks and energy companies that have made profits from interest rates and energy prices. The tax will be introduced in 2023 and is estimated to raise up to €7 billion in two years. Money raised from the tax will also be used to build 12,000 new homes and fund youth scholarship programmes.

Operators

 * Renfe is a state-owned company which operates freight and passenger trains on the "Iberian gauge",  standard gauge and  rail networks of the Spanish nationalized infrastructure company ADIF (Administrador de Infraestructuras Ferroviarias). Both were formed from the break-up of the former national carrier Renfe (Spanish: Red Nacional de los Ferrocarriles Españoles, "Spanish National Railway Network") and subsequently of FEVE (Ferrocarriles Españoles de Vía Estrecha, "Narrow-Gauge Spanish Railways").
 * Ouigo España is a subsidiary of the French company SNCF that operates long-range passenger trains on high-speed lines.
 * Iryo is the brand of ILSA, a Spanish-Italian company formed by Air Nostrum and Trenitalia that also operates long-range passenger trains on high-speed lines. Renfe, OUIGO and Iryo have all competed on several high-speed lines owned by ADIF after the liberalization of long-range passenger rail transport.
 * Euskotren (Eusko Trenbideak, Spanish: Ferrocarriles Vascos, "Basque Railways") operates trains on part of the narrow-gauge railway network in the Basque Country.
 * FGC (Ferrocarrils de la Generalitat de Catalunya, "Catalan Government Railways") operates several unconnected lines in Catalonia. It operates 140 km of narrow-gauge, 42 km of standard-gauge, and 89 km of Iberian-gauge routes, two metre-gauge rack railways and four funicular railways.
 * FGV (Ferrocarrils de la Generalitat Valenciana, "Valencian Government Railways") operates several metre-gauge lines in the Valencian Community.
 * FS (Catalan: Ferrocarril de Sóller, "Sóller Railways") operates an electrified narrow-gauge railway on the Spanish island of Majorca between the towns of Palma and Sóller.
 * SFM (Catalan: Serveis Ferroviaris de Mallorca, "Majorcan Railway Servicies") operates the metre-gauge railway network on the Spanish island of Majorca.
 * Acciona Rail Services, a subsidiary of Acciona, operates a coal cargo line between Asturias and the province of León.
 * COMSA Rail Transport, a subsidiary of COMSA, operates a cargo line from the Port of Gijón to Valladolid.
 * Continental Rail is dedicated to bringing materials into the gorges of the high-speed lines in progress.

Conventional Iberian-gauge lines

 * Alcázar de San Juan–Cádiz railway
 * Algeciras-Bobadilla railway
 * Barcelona–Cerbère railway
 * Casetas–Bilbao railway
 * Chinchilla–Cartagena railway
 * Córdoba–Málaga railway
 * León–A Coruña railway
 * Linares Baeza–Almería railway
 * Madrid–Barcelona railway
 * Madrid−Aranda−Burgos (mostly non-operational)
 * Madrid–Hendaye railway
 * Madrid–Valencia railway
 * Madrid−Valencia de Alcántara railway
 * Valencia−Sant Vicenç de Calders railway
 * Venta de Baños–Gijón railway
 * Huelva–Seville railway

Operational

 * Antequera–Granada high-speed rail line
 * Atlantic Axis high-speed rail line
 * Madrid–Barcelona high-speed rail line
 * Perpignan–Barcelona high-speed rail line (Figueres-Barcelona section)
 * Madrid–Asturias high-speed rail line
 * Madrid–Levante high-speed rail network (Madrid–Valencia, Madrid–Alicante)
 * Madrid–Málaga high-speed rail line
 * Madrid–Seville high-speed rail line
 * Madrid–Galicia high-speed rail line

Under construction

 * Basque Y
 * Murcia–Almería high-speed rail line

Narrow-gauge lines
In Spain there is an extensive 1,250 km (780 mi) system of metre-gauge railways.

Metro/light-rail systems

 * Alicante (Alicante Tram)
 * Barcelona (Barcelona Metro/Tram)
 * Bilbao (Bilbao Metro/Tram)
 * Cádiz (Cádiz Bay tram-train)
 * Granada (Granada Metro).
 * Jaén (Jaén Tram) built in 2011 but without service for political reasons.
 * Madrid (Madrid Metro)
 * Málaga (Málaga Metro)
 * Murcia (Murcia tram)
 * Palma (Palma Metro)
 * Parla (Parla Tram)
 * Santa Cruz de Tenerife (Tenerife Tram)
 * San Sebastián (San Sebastián Metro)
 * Seville (Seville Metro/Tram)
 * Valencia (Metrovalencia)
 * Vélez-Málaga (Vélez-Málaga Tram) opened in 2006, closed 2012
 * Vitoria-Gasteiz (Vitoria-Gasteiz tram)
 * Zaragoza (Zaragoza Tram)

Rail links with adjacent countries

 * France – break-of-gauge / (new high-speed line links without any break-of-gauge)
 * Portugal – same gauge

Andorra has no rail system (the closest station to Andorra is the French station of Andorre-L'Hospitalet station). The British overseas territory of Gibraltar also lacks a rail system. The Moroccan rail network is neither connected to the Iberian Peninsula (although an undersea tunnel has been proposed) nor to the Spanish autonomous cities of Melilla and Ceuta (respectively closest to the Moroccan stations of Beni Ansar and Tangier-Med).

Subsidies
In 2004, the Spanish government adopted a new strategic plan for transportation through 2020 called the PEIT (Strategic Plan for Infrastructures and Transport). This detailed rail subsidies of around €9.3 billion annually on average from 2005-2020. In 2010, it rolled out a two-year plan to invest an extra €11 billion each year for two years, as a part of a financial stimulus in response to the global downturn. In 2015, the federal budget for the railways was €5.1 billion.