I examine the optimal government subsidy of R&D activities when sectors are heteroge-neous. To this end, I build an endogenous growth model where R&D drives macroeconomic growth and firm dynamics in two sectors with different characteristics: a consumption-goods sector and an investment-goods sector. I highlight how various externalities in the innovation process affect the allocation of innovative resources across industries. I calibrate the model to U.S. data and study the quantitative properties of the model. By explicitly examining the transition path after the change in subsidy, I highlight the tradeoff be-tween the short-run level of consumption and long-run growth. I find that the optimal combination of the subsidy rates, as a fraction of firm R&D expenditures, is 84 percent in consumption sector and 88 percent in investment sector. By moving from the baseline subsidy rates (10 percent in both sectors), society can achieve a 20 percent welfare gain in consumption equivalent terms. The annual GDP growth rate increases from 1.5 percent to 3.2 percent by this change in subsidy. Finally, I show that it is always optimal to subsidize R&D spending in investment sector at a higher rate than that in the consumption sector when the government's subsidy budget is limited.(c) 2022 Elsevier Inc. All rights reserved.