The paper estimates the causal effect of trade liberalisation on aggregate productivity through mechanisms related to firm selection. The construction of a bridge in 2000 across the Öresund Strait linking Copenhagen with Malmö, Sweden's third largest city, provided a natural experiment with which to analyse this effect. A difference-in-difference methodology is applied using both geographic and sectoral variation in how much the bridge affected export patterns and productivity. Firms based in Malmö raise exports to Denmark substantially, mostly by firms selecting into exporting, and the aggregate productivity in Malmö increases. I find that almost all of Malmö's productivity growth is due to the reallocation of production from less productive to more productive firms. When decomposing the productivity gain, I find that these efficiency gains come mostly from the exit of the least productive firms but also from firms with an above-average productivity that start to export and therefore expand their output share. The two largest sectors in Malmö are wholesale trade and manufacturing. Exports by the wholesale sector in Malmö are strongly affected by the bridge whereas those of manufacturing are not. The productivity effects are also the strongest in the wholesale sector.