Soil nutrients are vital for plant growth and survival and present a crucial role in terrestrial function and productivity. However, little is known about the effect mechanism of groundwater table on soil nutrients in an arid desert ecological system. This study investigated the impacts of groundwater depth on the concentrations of soil organic carbon (C), available nitrogen (N), phosphorus (P), and potassium (K) at shallow groundwater depths (0.4, 0.8, 1.2, 1.8, and 2.2 m) and field deep groundwater depths (2.5, 4.5, and 11.0 m) in a desert-oasis ecotone in Central Asia in 2015 and 2016. Soil nitrate-N, inorganic-N, soil available P, and K concentrations were significantly affected by shallow and field deep groundwater. Groundwater depths did not alter soil ammonium-N concentration. Soil organic C concentration was influenced by field deep groundwater depth. Structural equation model showed that groundwater depth directly affected soil nitrate-N and K concentrations and indirectly altered the soil inorganic-N, soil organic C and available P concentrations in shallow groundwater. Moreover, groundwater depth directly influenced soil nitrate-N and soil organic C, available P and K concentrations and indirectly affected soil inorganic-N concentration in deep groundwater. Hence, groundwater depth should be considered one of the most critical environmental factors affecting soil nutrient variation in an arid desert. This study provides new insights into the soil nutrient variation under a declining groundwater depth in a hyper-arid ecosystem.