# History of rail transport in Spain

The history of rail transport in Spain begins in the 19th century. In 1848, a railway line between Barcelona and Mataró was inaugurated, although a line in Cuba (then a Spanish overseas province) connecting Havana and Bejucal had already opened in 1837. In 1852 the first narrow gauge line was built, in 1863 a line reached the Portuguese border. By 1864 the Madrid-Irun line had been opened, and the French border reached.
In 1911 the first line to be electrified was the Gergal-Santa Fe line.
In 1941 RENFE was created.
The last steam locomotive was withdrawn in 1975, in 1986 the maximum speed on the railways was raised to 160 km/h (99 mph), and in 1992 the Madrid–Seville high-speed rail line opened, beginning the process of building a nationwide high speed network.

## Development

Railway transport was first developed in Northern Europe during the 19th century, spurred not only by rapid economic growth, but also by landscapes favourable to railway construction. The mountainous terrain, low population density, relatively weak 19th century economic development and political up-and-downs hindered the development of the railway network in Spain. There was an operating railway in the island of Cuba since 1837: The Havana–Bejucal stretch of the Havana–Güines line was finished in 1837, and the full line in 1838. The first line to be built in the Peninsula was a short link from Barcelona to Mataró opened in 1848. Prior to 1854, the only lines built in Mainland Spain were Barcelona–Mataró, Madrid–Aranjuez (prolonged to Albacete), Langreo–Gijón and Valencia–Játiva. The development of a true railway network began under the overarching legal frame of the 3 June 1855 Ley General de Caminos de Hierro, during the bienio progresista.
A major company, the Compañía de los Ferrocarriles de Madrid a Zaragoza y Alicante [es] (MZA), was constituted in 1856 as joint venture of the Marquis of Salamanca and the Rothschilds. Primarily led by the Péreires, its main rival was the Compañía de los Caminos de Hierro del Norte de España ('Norte'), constituted in 1858.
One key development was the decision, taken at an early stage, that Spain's railways should be built to an unusual broad track gauge of 1,672 mm (5 ft 5+13⁄16 in), or six Castilian feet). Some believe that the choice of gauge was influenced by Spain's hostility to neighbouring France during the 1850s: it was believed that making the Spanish railway network incompatible with that of France would hinder any French invasion. Other sources state that that decision was taken to allow bigger engines that could have enough power to climb the steep passes of a mountainous country such as Spain. As a result, Portuguese railways were also built to a broad gauge (roughly the same, 1,664 mm or 5 ft 5+1⁄2 in, but rounded to five Portuguese feet). In 1955 Spain and Portugal decided to halve this difference of 8 mm (5⁄16 in), and defined their gauge to be 1,668 mm (5 ft 5+21⁄32 in), called Iberian gauge.
The decision for an Iberian gauge would later come to hinder interoperability of rail services with France, and it also made railway construction more expensive. Apart from the widespread broad-gauge lines, a large system of narrow gauge railways was built in the more mountainous parts of Spain, especially in the north coast of the country, where narrow gauge was the most adequate option. As of 2024 there are still Iberian gauge tracks all over Spain. In 2023 transport officials in RENFE in Spain resigned when it was found that narrow-gauge passenger rolling-stock ordered in 2020 for the northern regions of Asturias and Cantabria would be too wide for the tunnels and were to be redesigned with delays of a year or two in delivery.
The main-line network was roughly complete by the 1870s. Because of Spain's (until recently) relative lack of economic development, the Spanish railway network never became as extensive as those of most other European countries. For instance, in terms of land area Spain is about 2.5 times the size of Great Britain but its railway network is about 3,000 km (1,900 mi) smaller.
During the Spanish Civil War in the 1930s the railway network was extensively damaged.

## Nationalization of rail network

Immediately after the war Francoist Spain nationalized the broad gauge network, and in 1941 RENFE was formed. Narrow gauge lines were nationalized in the 1950s, later being grouped to form FEVE.
It took many years for the railway system to recover from the war. In spite of this, innovators like Goicoechea created advanced trains like the Talgo and the TER. Only with the Spanish transition to democracy in 1975, did the Spanish railway network begin to modernize and catch up with the rest of Europe.
Following the decentralization of Spain after 1978, those narrow gauge lines which did not cross the limits of autonomous communities of Spain were taken out of the control of FEVE and transferred to the regional governments, which formed, amongst others, Eusko Trenbideak and Ferrocarrils de la Generalitat de Catalunya. Madrid (Madrid Metro), Barcelona, Valencia and Bilbao (Metro Bilbao) all have autonomous metro services.
In 1986/7, many radial routes were closed: thousands of kilometres of passenger lines were axed.
The Railway Sector Act of 2003 separated the management, maintenance and construction of rail infrastructure from train operation. The former is now the responsibility of Administrador de Infraestructuras Ferroviarias (ADIF), while Renfe owns the rolling stock and remains responsible for the planning, marketing and operation of passenger and freight services (though no longer with a legal monopoly).

## High speed

Over the last decades Spain's railways have received very heavy investment, much of it coming from the European Union. In 1992, a standard gauge high-speed rail line was built between Madrid and Seville via Córdoba and went into commercial operation in April that year in time for the Seville Expo '92. The AVE high-speed service was introduced for first time on the 476 km long Madrid–Seville route on trains capable to reach speeds up to 300 km/h. Later the same year another high-speed service for medium distances and speeds up to 250 km/h was introduced called AVE Lanzadera, which was later renamed to Avant, and initially offered intermediate connections on the same line.
In 1997 Renfe offered another high-speed service, this time on the upgraded old Iberian gauge lines along the Spanish Mediterranean Corridor, such as the Valencia−Sant Vicenç de Calders railway for the most part, at top speeds between 200 km/h and 220 km/h. This service is called Euromed and is running since then between the cities of Barcelona, Tarragona, Castellón de la Plana, Valencia and Alicante. In 2020 the service was extended to Girona and Figueres by using new dual-gauge trainsets, capable of reaching speeds up to 250 km/h (160 mph) when running on the standard gauge high-speed sections.
In 2003, a second AVE service was introduced on a new standard gauge line from Madrid to Lleida via Zaragoza. The branch section from Zaragoza to Huesca put in service in April 2005 for direct Madrid–Huesca AVE trains and the Madrid–Toledo railway was inaugurated in November the same year introducing a new Avant service on that route. Additional Avant services were offered on the routes Zaragoza–Huesca and Zaragoza–Calatayud.
The extension of the Madrid–Lleida line to Tarragona was completed in December 2006 with the inauguration of the new Camp de Tarragona station and then further to Barcelona in February 2008, expanding the AVE service in the line by linking the two major Spanish cities in just 2 hours and 35 min. With the completion of this line new long-distance AVE services were introduced on the Seville−Barcelona and Málaga−Barcelona routes, as well as a new Avant service on the Barcelona−Camp de Tarragona−Lleida route.
The Madrid–Barcelona line is extended via an international Perthus Tunnel beneath the Pyrenees to Perpignan where it is linked up with the French TGV high-speed system. Although the LGV Perpignan-Figueres was finished on the French side since 2010, delays on the part of the French government in authorizing construction on its side of the border held up Spanish plans to some extent, and the Spanish side could not be finished before January 2013, when the entire Barcelona–Figueres section was officially inaugurated. Since then AVE services connect Madrid directly to Girona and Figueres via Barcelona and additional Avant services are offered on the Barcelona–Girona–Figueres route. International high-speed services between Spanish and French cities are also offered.
In December 2007, the new built high-speed section from Madrid to Valladolid was inaugurated and put in service initially for AVE and later for Avant trains. This is the first installment of a high-speed rail corridor in the north and northwest of Spain. At the same time the Madrid–Málaga high-speed rail line was inaugurated when the new section from Córdoba to Málaga was finished offering direct AVE services from Malaga to the Spanish capital and a new Avant service on the route Málaga−Córdoba−Sevilla.
In December 2010 the Madrid–Cuenca–Valencia high-speed railway along with the Cuenca–Albacete branch were finished as the first parts of the Madrid–Levante high-speed rail network and two new AVE services were introduced connecting with Madrid. This network was expanded on 18 June 2013 when the Albacete–Alicante section was inaugurated introducing the Madrid–Alicante AVE service. In the same year another Avant service was introduced between Requena-Utiel and Valencia.
The first high-speed service in the region of Galicia was the Avant train on the route Ourense–Santiago de Compostela–A Coruña which since December 2011 is offered by Renfe on that new built Iberian gauge high-speed section, which is due to be converted to standard gauge in the future. In April 2015 the line was extended with a branch section from Santiago de Compostela to Vigo forming the Atlantic Axis high-speed rail line designed for speeds up to 250 km/h. Additional high-speed services up to the city of Vigo were introduced.
In recent years the network was expanded with more lines such as the Seville–Cádiz section inaugurated in October 2015, the Valencia–Castellón de la Plana section in January 2018, the Antequera–Granada section in June 2019, the Madrid–Galicia high-speed rail line in December 2021, the Venta de Baños–Burgos section in July 2022, the section Monforte del Cid–Elche–Orihuela–Murcia in December 2022 and the Madrid–Asturias high-speed rail line in November 2023 bringing additional high-speed services to more cities and regions across the country.
Since May 2021 the private operator Ouigo España and since November 2022 another another private operator Iryo also offer high-speed services across the Spanish high-speed rail network by using their own trains. In June 2021 the public operator Renfe lunched a low-cost high-speed service called Avlo on various routes across Spain.
Further high-speed links are under construction such as from Madrid to Lisbon via the region of Extremadura, from Madrid to the region of Cantabria and the city of Santander, from Burgos to the Basque Country and the Basque Y that will link the three main Basque cities, from Zaragoza to Pamplona and finally the Murcia–Almería high-speed rail line.

## Loading Gauge
### Width

Standard gauge was adopted in Spain partly in view of the desire to integrate with the rest of Europe, and the rest of Africa. If it uses the UIC loading gauge width of 3,150 millimetres (10 ft 4 in) then there would be inconsistency with the 3,400 millimetres (11 ft 2 in) width of the futuristic African Integrated High Speed Railway Network.
Thus UIC width trains can happily work on OSShD platforms with a wider gap, but not the other way round.