The ZafraâÂÂHuelva railway is a 180.8-kilometre (112.3-mile) railway line part of the Spanish railway network. It is an Iberian gauge (1,668 mm), single-track, non-electrified line primarily used for regional traffic. According to Adif's classification, it is designated as "line 512".
The line's origins date back to the late 19th century, when construction began under the initiative of Spanish-German entrepreneur Guillermo Sundheim. Opened in 1889, its operation ended the isolation of the Andévalo and Sierra regions. The line also connected to several mining branch lines via junctions. As a result, for many years, it facilitated significant freight traffic from local mines to the Port of Huelva. Initially managed by the , the line came under the control of the state-owned RENFE in 1941.
The railway declined in the second half of the 20th century as the closure of many Huelva mines eliminated a key source of freight traffic. A lack of investment led to aging infrastructure and deteriorating services. Although closure was considered, modernization efforts began in the 2000s. Today, the line is part of the and is managed by Adif.
The line's origins trace back to 1870, when the Spanish government offered a concession for the ZafraâÂÂHuelva railway in a public auction, which garnered no interest. In 1878, the concession was granted to Sundheim & Doetsch, led by Spanish-German entrepreneur Guillermo Sundheim. Initially, the line was intended to connect Zafra with the Riotinto mining railway, operational since 1875. However, various issues led to the decision to build a new route closer to the Portuguese border. In 1879, the project was assigned to chief engineer . The final concession was granted on August 20, 1881, with a subsidy exceeding eleven million pesetas. Sundheim began construction immediately, transferring the concession to the (ZH) in 1884. Work took place between 1881 and 1889, navigating the challenging terrain of Sierra Morena. Most construction materials were imported by sea. The ValdelamusaâÂÂHuelva section opened on July 23, 1886, and the ZafraâÂÂValdelamusa section on January 1, 1889. Construction was arduous, requiring nearly twenty tunnels and nineteen iron bridges, including the notable Tres Fuentes Bridge.
The 179-kilometre (111-mile) line featured around twenty stations and sidings to manage traffic. In Huelva, a major railway complex, , included a locomotive depot serving the entire line.
Although the line was not fully completed until 1889, partial operations began in 1884. Its opening connected the isolated Andévalo region with the rest of Huelva province, benefiting numerous municipalities. It also created a rail corridor linking Extremadura provinces with a maritime port on the Atlantic Ocean, facilitating the transport of agricultural and mineral resources. Passenger traffic exceeded initial projections, with 132,360 passengers transported in 1897. The ZH company acquired nearly thirty steam locomotives, including notable models from the British manufacturer Dübs.
Guillermo Sundheim aimed to make the ZafraâÂÂHuelva railway a key route for transporting minerals to the Port of Huelva. The presence of numerous mines along the route led to the construction of narrow-gauge branch lines connecting deposits to the railway. Over time, the line linked to mines such as , , , , , , , and . Due to differing track gauges, transshipment facilities were established for pyrite. The and stations became primary hubs for mineral traffic, as most branch lines converged there.
The El Perrunal mine generated the most pyrite traffic, with over 7.5 million tonnes transported between 1901 and 1960. Its Iberian-gauge branch line eliminated the need for transshipment. Other mines also contributed significantly: Lomero-Poyatos transported 1,553,812 tonnes from 1905 to 1960, San Telmo 1,327,275 tonnes from 1903 to 1960, and Cueva de la Mora over one million tonnes from 1888 to 1960.
Passenger traffic was also significant. In 1929, a Sentinel-Cammell railcar, nicknamed the "green louse" for its speed of 80 km/h (50 mph), began operating passenger services. In 1936, the GibraleónâÂÂAyamonte line opened, branching from , increasing the line's connectivity. That year, the also opened, aiming to reach the Portuguese border via Villanueva del Fresno.
In 1941, following the nationalization of Spain's Iberian-gauge railways, the ZafraâÂÂHuelva line was integrated into the newly formed RENFE. RENFE expanded the locomotive fleet, incorporating steam engines from the MZA and networks, and later "American" locomotives from Norte. Due to poor infrastructure conditions, the track was fully renovated in the mid-1950s, and metal viaducts were replaced with concrete ones between 1954 and 1956. During this period, the line saw heavy traffic, with 421,125 passengers in 1955 and 416,995 in 1964.
In the 1960s, steam traction was phased out, and passenger services transitioned to railbuses and diesel railcars. However, the rise of road transport reduced passenger numbers. Mining branch lines, including the , closed in 1969, with the San Telmo branch shutting in the early 1970s. Mineral loading at Valdelamusa continued until February 1991. In 1976, the Huelva-Odiel station closed, and a new variant extended the line to .
By the mid-1980s, despite the decline in Andévalo mining, the line maintained significant freight traffic, transporting phosphate from Cáceres, liquid fuels from the , and sulfuric acid from the Minas de Almagrera plant in . Pyrite trains from the Tharsis mines also used the line via Gibraleón. However, chronic underinvestment led to outdated infrastructure and low speeds, and RENFE classified the line as highly unprofitable in 1984.
In January 2005, RENFE split into Renfe Operadora and Adif, with the latter assuming control of the line. By then, both passenger and freight traffic had significantly declined. Between 2004 and 2016, â¬48 million was invested to upgrade the ZafraâÂÂJabugo section, including track, sleeper, and ballast renewal. Numerous railway facilities were refurbished, and new passenger buildings and platforms were constructed. Post-2020, safety was improved by replacing the telephone block system with a Centralized Traffic Control (CTC) system. In 2022, infrastructure upgrades began on the ValdelamusaâÂÂHuelva section. In summer 2023, the line was closed to replace five bridges, extending their lifespan.
The ZafraâÂÂHuelva railway is a conventional, 180.8-kilometre (112.3-mile), single-track, non-electrified line with Iberian gauge. The challenging terrain of the Andévalo, particularly between Cumbres Mayores and Valdelamusa, necessitated eighteen tunnels, most over 100 meters long, with the Almonaster tunnel extending 1,350 meters. The line includes nineteen bridges and viaducts, notably those over the Múrtigas River, Tres Fuentes, and Alcolea. At Zafra, it connects to the MéridaâÂÂLos Rosales railway and , and in Huelva, it links to the .
Originally, the line terminated at , with branches to the port. After the station's closure in July 1976, the "Peguerillas variant" was built to connect directly to the SevilleâÂÂHuelva line and . This eliminated the track between kilometers 172 and 179, which was later dismantled. The line now ends at .
The ZafraâÂÂHuelva railway has limited, primarily regional traffic, as it lies outside Spain's main transport corridors. Freight trains between Extremadura and Huelva, and those from the Chemical Park of Huelva, dominate the line. Passenger traffic is minimal, served by operated by Renfe. According to 2021 Adif data, the line averages four daily trains in both directions, with 40% capacity utilization.