There are eight provinces and autonomous regions (Gansu Province, Ningxia Hui Autonomous Region, Xinjiang Uygur Autonomous Region, Inner Mongolia Autonomous Region, Tibet Autonomous Region, Qinghai Province, Shanxi Province, and Shaanxi Province) in Northwest China, most areas of which are located in arid and semi-arid regions (northwest of the 400 mm precipitation line), accounting for 58.74% of the country's land area and sustaining approximately 7.84×106 people. Because of drought conditions and fragile ecology, these regions cannot develop agriculture at the expense of the environment. Given the challenges of global warming, the green total factor productivity (GTFP), taking CO2 emissions as an undesirable output, is an effective index for measuring the sustainability of agricultural development. Agricultural GTFP can be influenced by both internal production factors (labor force, machinery, land, agricultural plastic film, diesel, pesticide, and fertilizer) and external climate factors (temperature, precipitation, and sunshine duration). In this study, we used the Super-slacks-based measure (Super-SBM) model to measure agricultural GTFP during the period 2000-2016 at the regional level. Our results show that the average agricultural GTFP of most provinces and autonomous regions in arid and semi-arid regions underwent a fluctuating increase during the study period (2000-2016), and the fluctuation was caused by the production factors (input and output factors). To improve agricultural GTFP, Shaanxi, Shanxi, and Gansu should reduce agricultural labor force input; Shaanxi, Inner Mongolia, Gansu, and Shanxi should decrease machinery input; Shaanxi, Inner Mongolia, Xinjiang, and Shanxi should reduce fertilizer input; Shaanxi, Xinjiang, Gansu, and Ningxia should reduce diesel input; Xinjiang and Gansu should decrease plastic film input; and Gansu, Shanxi, and Inner Mongolia should cut pesticide input. Desirable output agricultural earnings should be increased in Qinghai and Tibet, and undesirable output (CO2 emissions) should be reduced in Inner Mongolia, Xinjiang, Gansu, and Shaanxi. Agricultural GTFP is influenced not only by internal production factors but also by external climate factors. To determine the influence of climate factors on GTFP in these provinces and autonomous regions, we used a Geographical Detector (Geodetector) model to analyze the influence of climate factors (temperature, precipitation, and sunshine duration) and identify the relationships between different climate factors and GTFP. We found that temperature played a significant role in the spatial heterogeneity of GTFP among provinces and autonomous regions in arid and semi-arid regions. For Xinjiang, Inner Mongolia, and Tibet, a suitable average annual temperature would be in the range of 7°C-9°C; for Gansu, Shanxi, and Ningxia, it would be 11°C-13°C; and for Shaanxi, it would be 15°C-17°C. Stable climatic conditions and more efficient production are prerequisites for the development of sustainable agriculture. Hence, in the agricultural production process, reducing the redundancy of input factors is the best way to reduce CO2 emissions and to maintain temperatures, thereby improving the agricultural GTFP. The significance of this study is that it explores the impact of both internal production factors and external climatic factors on the development of sustainable agriculture in arid and semi-arid regions, identifying an effective way forward for the arid and semi-arid regions of Northwest China.