Vegetation dynamics are critical to the terrestrial carbon and water cycle, with China recognized as one of the largest contributors to global greening due to significant variations in forest coverage. However, distinguishing the effects of vegetation changes from those of climate factors on vegetation productivity remains challenging. This study conducted a comprehensive analysis of vegetation productivity in Northwest China over the past two decades, focusing on the spatiotemporal patterns and drivers of gross primary production (GPP) within ecological restoration areas. Using trend analysis and ridge regression models, we assessed the relative contributions of climate factors and vegetation coverage changes to GPP dynamics. The results revealed a significant increase in both the GPP and vegetation coverage in Northern China from 2001 to 2020, with GPP rising by 6.7 g C m−2 yr−1 and forest coverage increasing by 0.08% per year. A strong positive correlation (r = 0.9) was observed between vegetation coverage changes and GPP. The increase in GPP was driven by both climate factors and changes in forest coverage, with climate factors contributing 61.0% and vegetation coverage changes contributing 39.0%. Among the climate factors, radiation, temperature, and precipitation contributed 15.4%, 6.4%, and 39.2%, respectively. The study highlights the critical role of ecological restoration efforts, particular in regions like the Less Plateau and Inner Mongolian Plateau, in enhancing vegetation productivity. These findings provide valuable insights for addressing desertification and inform strategies for ecological restoration and sustainable development in Northern China.