This paper investigates socially optimal patterns of economic growth and environmental quality in a neoclassical growth model with endogenous technological progress. In the model, environmental quality has a positive effect not only on utility but also on production. Moreover, cleaner technologies can be used in the economy if a part of the output is used in environmentally oriented R&D. In this framework, if the initial level of capital is low, then the shadow price of a cleaner technology is low in relation to the cost of developing it, given by the marginal utility of consumption, and it is not worth investing in R&D. Thus, there will be a first stage of growth based only on the accumulation of capital with environmental quality decreasing until there is enough pollution to make investing in R&D profitable. After this turning point, if the new technologies are efficient enough, the economy can evolve along a balanced growth path with increasing environmental quality. The result is that the optimal investment pattern supports an environmental Kuznets curve.