In this article we study differences in the returns to R&D investment between firms that sell in international markets and firms that only sell in the domestic market. We use German firm-level data from the high-tech manufacturing sector to estimate a dynamic structural model of a firm's decision to invest in R&D and use it to measure the difference in expected long-run benefit from R&D investment for exporting and domestic firms. The results show that R&D investment leads to a higher rate of product and process innovation among exporting firms and these innovations have a larger impact on productivity improvement in export market sales. As a result, exporting firms have a higher payoff from R&D investment, invest in R&D more frequently than firms that only sell in the domestic market, and, subsequently, have higher rates of productivity growth. The endogenous investment in R&D is an important mechanism that leads to a divergence in the long-run performance of firms that differ in their export market exposure. Simulating the introduction of trade tariffs we find a substantial reduction in firms' productivity growth and incentive to invest in R&D.