With the growing importance of sustainable development, ESG is receiving attention from governments, firms, and investors. This study uses the reform of China’s tax inspection system—Golden Tax Project III—as a quasi-natural experiment to examine the impact of the enhanced tax administration on firms’ ESG performance with a sample of Chinese A-share listed companies from 2008 to 2020. The findings, which were identified via a time-varying difference-in-differences (time-varying DID) approach, indicate that Golden Tax Project III significantly reduces firms’ ESG performance and has the most significant impact on the environmental dimension and the minor impact on the social dimension. The negative impact of Golden Tax Project III on ESG performance is more substantial among non-state firms and firms in regions with higher levels of marketization than other firms. The mechanism test shows that Golden Tax Project III negatively affects ESG performance by increasing the tax burden on firms. The moderating effect test shows that tax incentives can effectively mitigate the dampening effect of strengthened tax administration on ESG performance. This study enriches the literature on the factors influencing firms’ ESG performance to a certain extent; it helps the government use taxation policies to inspire firms to improve ESG performance, contributing to sustainable development.