This paper examines the structure of the shipping network and its implications on global trade and welfare. Using novel data on the movements of container ships, we calculate optimal travel routes. We then estimate the impact of a shock to the network on global trade by means of a natural experiment: the 2016 Panama Canal expansion. Trade between country pairs using the canal increased by 9-10% after the expansion. While the building costs were borne by Panama alone, a model-based quantification shows that the welfare gains were shared by many countries, due to the network structure of shipping.