This paper reviews and defines ESG performance and total factor productivity (TFP) of firms, and proposes a research design. Using a sample of Chinese A-share listed companies from 2015 to 2024, the study empirically tests the impact of ESG ratings on firm TFP and its underlying mechanisms. The findings are as follows: (1) In a replacement test of the dependent variable, the regression coefficient of ESG disclosure on TFP from the previous period is 0.003, and it is significantly positive at the 1% level. By replacing the explanatory variable, the TFP calculated using the LP method based on Huazheng ESG is significantly positive at the 1% level, validating the robustness of the conclusion. (2) ESG indirectly enhances TFP through two pathways: incentivizing technological innovation and alleviating financing constraints. (3) Digital transformation positively moderates the relationship between ESG and TFP. Further analysis indicates that environmental performance has a U-shaped relationship with TFP, while social and governance performance have a linear positive impact.