This paper develops a model of intermediate and final goods trade based on comparative advantage. Firms endogenously decide whether to produce a final good directly using labour, or indirectly using both labour and intermediate inputs. It is shown that the gains from trade in intermediate and final goods exceeds that from trade in final goods alone. Falling trade and coordination costs result in an endogenous change in the structure of production towards a more fragmented structure, with corresponding implications for trade patterns.