We study whether R&D-intensive firms are more resilient to trade shocks. We correct for the endogeneity of R&D using tax-induced changes to R&D cost. While rising imports from China lead to slower sales growth and lower profitability, these effects are significantly smaller for firms with a larger stock of R&D (by about half when moving from the bottom quartile to the top quartile of R&D). We provide evidence that this effect is explained R&D allowing firms to increase product differentiation. As a result, while firms in import-competing industries cut capital expenditures and employment, R&D-intensive firms downsize considerably less