In 1872 the Companhia Carril Americano do Porto à Foz e Mattosinhos opened the first mule tram line in Porto, connecting Rua dos Inglezes (nowadays Infante) with Foz (Castelo) and Matosinhos. In the next year, a branch line from Massarelos to Cordoaria was opened. A second company, the Companhia Carris de Ferro do Porto (CCFP) (the Porto Tramways Company), was established in 1873, and it opened a line from Praça Carlos Alberto via Boavista to Foz (Cadouços) in 1874. More lines were added through the 1870s until the 1890s. In 1878 the CCFP line from Foz to Boavista was converted to steam traction. At Boavista was the change of traction between mules and steam engines. Four years later, the interurban line of the CCFP was extended from Foz (Cadouços) to Matosinhos. CCAPFM and CCFP merged on 13 January 1893, using the latter's name for the resulting company. Electric traction was introduced in 1895. The last mule-drawn car was retired in 1904, and electrification was complete with the elimination of urban steam engines in 1914.
In 1946, the city purchased the tram system from CCFP and took over its operation, with a new municipal company, Serviço de Transportes Colectivos do Porto (STCP). By 1949, it reached its maximum length of 81 kilometers with 150 kilometers track length. The 1960s and the 1970s were marked by a continuous dismantling of tram tracks and a preference for cheaper bus transport. The system shrank from 81 kilometers with 192 cars in 1958, to 38 kilometers with 127 cars in 1968, to 21 kilometers with 84 cars in 1978, to just 14 kilometers with 16 cars in 1996. The last remaining line (18) was the start of the current heritage tram system.
For many years, the system had more than 20 lines, but most were closed during the 1960s and 1970s.:45–47 By July 1978, only four routes remained: 1, 3, 18 and 19. Route 3 (Boavista – Pereiró) closed on 30 April 1984. For almost 10 more years, the three remaining routes continued in operation without any closures, as routes 1 (Infante – Matosinhos), 18 (Carmo – Castelo do Queijo – Boavista) and 19 (Boavista – Matosinhos).:46 The section from Castelo do Queijo to Matosinhos was closed on 11 September 1993 with the withdrawal of route 19 and of that section of route 1. The remainder of route 1, between Castelo do Queijo and Infante, was withdrawn on 10 September 1994.:46 On 11 June 1996, the final route, 18, was downgraded from a full-service tram line to a heritage service with reduced frequency, but operating seven days a week. Buses took over most of the service on the route at that time, but with trams continuing to operate some trips, as a heritage service. The service used only three trams, operating on a 35-minute headway. Route 18's 4-km section along Avenida Boavista was later closed, but tram service was gradually re-introduced in the 2000s on other sections, in the form of additional heritage-tram services, lines 1 and 22, as well as the former Line T (the Porto Tram City Tour, which has since been discontinued).
The Tram Museum building on the bank of the Douro.
The Tram Museum is located in the old central power plant of the tram in Massarelos, next to an active STCP depot. The museum was inaugurated in May 1992. It preserves sixteen electric cars, five trailer cars and two maintenance cars. A parade of old cars is held annually along the streets of Massarelos and Passeio Alegre.
As at November 2014 the museum is indefinitely closed with staff onsite unable to give a date of reopening, though it had reopened by November 2016 with an €8 entrance charge.