This paper studies the distributional and aggregate economic effects of new port technologies developed in the second half of the 20th century. We show that new technologies have led to a significant reallocation of shipping activity from large to small cities. This was driven by a land price mechanism; as new port technologies are more land-intensive, ports moved from large, high land price cities to smaller, lower land price ones. We add endogenous port development to a standard quantitative model of crosscity trade to account for both the benefits and the costs of port development. According to the model, the adoption of new port technologies leads to benefits through increasing market access but is costly, requiring the extensive use of land, suggesting a reallocation of shipping activities towards cities with low land prices and thus net gains from new port technologies that are heterogeneous across cities. Counterfactual results suggest that new port technologies led to sizable aggregate gains for the world economy, with substantial heterogeneity in the effects across countries. More generally, accounting for the costs of port infrastructure development endogenously has the potential to alter the size and distribution of the gains from trade.