During a pivotal time for global environmental challenges and economic restructuring, investigating the potential of new digital infrastructure (NDI) to enhance ecological total factor productivity (ETFP) emerges as crucial for propelling sustainable development initiatives. This study utilizes panel data collected from Chinese cities from 2010–2021, combining econometric models, Python text analysis, equivalence factor method, and ArcGIS overlay analysis to theoretically and empirically examine whether NDI can enhance ETFP and its action mechanisms. The study finds that NDI significantly enhances ETFP. After a series of robustness checks and instrumental variable regressions, the conclusions remain valid. Further mechanism tests reveal that the construction of NDI effectively boosts ETFP primarily through dual-structure optimization effect, green innovation effect, and economic agglomeration effect. The influence of NDI on enhancing ETFP exhibits significant heterogeneity, especially on the west side of the Hu Huanyong Line, in ecological regulation functional zones, resource-based cities, cities dominated by the secondary industry, and smart cities, where the effects of NDI on enhancing ETFP are more pronounced. Moreover, this effect shows temporal differences, particularly after 2013, when the enhancement effect became significantly strong. Furthermore, as resource allocation efficiency and public environmental awareness increase, this enhancement effect become even increasingly significant. This study not only deepens the understanding of the potential for NDI to promote sustainable development but also furnishes theoretical and empirical substantiation for the green transformation of the global economy.