In the context of sustainable development, countries around the world shed more light on green innovation in their environmental policies, and the digital economy may take a vital part in improving green innovation. Predicted on the panel data of 278 cities in China from 2011 to 2019, this research administrates the principal component analysis (PCA) to evaluate the advancement level of the urban digital economy and employs the number of urban green patent applications to represent green innovation level. Through the benchmark regression model, the mediating effect model, the spatial Durbin model, the dynamic threshold panel model, and the gradual difference-in-difference model, this paper explores the direct effect, indirect effect, spatial effect, nonlinear relationship, and policy effect of that digital economy has on green innovation. The development of the digital economy can improve green innovation levels in indirect ways, such as by boosting the degree of economic openness, optimizing the industrial structure, and expanding the market potential, and as economic openness, industrial structure, and market potential advance, the promotion intensity of digital economy on green innovation is becoming lower and lower. The development of green innovation has an obvious spatial spillover effect. Still, the enhancement of green innovation in more developed regions may inhibit green innovation in less developed regions due to talent flow and industrial transfer. Finally, the gradual difference-in-difference model founded on the 'Broadband China' pilot policy supplementarily verifies that digital economy enhancement can substantially advance urban green innovation.