We exploit a panel dataset of Hungarian firms merged with product-level trade data for the period 1992-2003 to investigate the relation between firms’ trading activities (importing, exporting or both) and productivity. We find important self-selection effects of the most productive firms induced by the existence of heterogeneous sunk costs of trade, for both importers and exporters. We relate these sunk costs of trade to the relationship-specific nature of the trade activities, entailing a certain degree of technological and organizational complexity. We also show that, to the extent that imports and exports are correlated within firms, failing to control for the importing activity leads to overstated average productivity premia of exporters.