Economic green transition is the change of economic development mode under environmental constraints; this process will generate huge demand for credit financing. Understanding the connection between credit allocation and environmental performance is crucial for the coordinated development of the economy and environment. Utilizing the Chinese Industrial Enterprises Database, I constructed a city-level green credit index and compiled panel data from 2006 to 2013 for 282 selected cities in China. A spatial model was employed to explore the influence of green credit on the economic green transition. The findings reveal a positive relationship between green credit and economic green transition during the study period. Green credit not only enhances local green total factor productivity but also exerts beneficial impacts on adjacent areas though demonstration effects. Additionally, the reallocation of credit resources and the innovation of clean technologies are identified as key mechanisms through which green credit fosters a greener economy. However, the study also finds that the impact of green credit is moderated by factors such as a high reliance on natural resources, the underdevelopment of market intermediaries, and excessive governmental intervention, which can undermine its effectiveness. Furthermore, the efficacy of green credit exhibits regional heterogeneity; it has a significant positive impact in the eastern regions of China, while its influence appears to be non-significantly positive in the central and western regions. This study enriches the research on the macroeconomic impacts of green credit, offering practical evidence and theoretical support for the implementation of green credit policies by local governments in China.