China’s National Key Ecological Function Zones (NKEFZs) currently represent the largest and most extensive ecological conservation policy in China, with one of the core objectives of this policy being to improve eco-environmental quality (EEQ). This study regards the establishment of NKEFZs as a quasi-natural experiment. Based on panel data from 130 counties in Sichuan Province from 2001 to 2021, a multi-period difference-in-differences (DID) model was employed to evaluate the impact of NKEFZ establishment on EEQ. The findings indicate the following: ① The establishment of NKEFZs can significantly enhance the EEQ of the covered areas, albeit as a gradual long-term process. This conclusion not only meets the parallel-trends assumption but also holds true in a series of robustness tests such as placebo tests. ② Mechanism analysis reveals that NKEFZs can enhance EEQ through the effects of optimizing land spatial allocation and upgrading industrial structure. ③ Heterogeneity analysis demonstrates that the beneficial effect of NKEFZs on EEQ varies across different functional zone types, geographic spaces and ethnic regions. Our study not only contributes to the accumulation of empirical evidence and institutional refinement in the sustainable implementation of ecological policies in China but also offers valuable insights and references for other countries in formulating policies for eco-environmental protection.