We study the construction of the 19th-century Swedish railroad network and esti- mate its effects on innovation during two centuries. To address endogenous placement of the network, our analysis exploits the fact that the main trunk lines were built with the overarching aim to connect particular city centers, while at the same time considering construction costs. Estimates show that innovative activities increased substantially in areas traversed by the railroads: the number of active innovators in- creased and the average innovator became more productive. Exploring the effects on knowledge diffusion across space, our analysis shows that innovators residing in areas connected by the railroad start to collaborate more and over longer distances, espe- cially with other innovators located along the railroad network. Finally, we show that the differences in innovative activities were intensified over the 20th century. Areas traversed by the historical railroads exhibit much higher rates of innovation today.