This paper investigates the impact and mechanism of the China‐U.S. trade war on firm innovation in China exploiting the trade war as a quasi‐natural experiment using firm‐level data from 2015 to 2020. We apply textual analysis to annual reports of listed firms to identify treatment and control groups. Our DID estimates show that while the trade war is a negative shock, it has increased the number of total patent applications, invention patent applications, and non‐invention patent applications by 6.0%, 3.7%, and 4.1%, respectively. We also observe that government subsidies could help firms resist adverse shocks on time with more innovation outcomes. Furthermore, we find the pertinence of government subsidy. The government tended to grant subsidies to firms that have trade connections with the U.S. and firms would use subsidies for R&D to increase innovation. Overall, we find that the trade war prompts the government to increase subsidies for firms, thereby boosting innovation.