Soil nutrient stoichiometry is fundamental to ecosystem functioning. However, it remains unclear how long-term vegetation restoration affects its dynamics. This study utilized long-term monitoring to compare soil C, N, and P stoichiometric characteristics under five stand types: cropland (CK), natural secondary forest (NSF), Robinia and Pinus mixed forest (RPF), Robinia pseudoacacia plantation (RF), and Pinus tabuliformis plantation (PTF). Specific focus was given to soil organic carbon (SOC), total nitrogen (TN), and total phosphorus (TP), as well as their C:N, C:P, and N:P ratios. During 30 years of vegetation restoration, SOC and TN increased by 11.65% and 7.46%, while TP decreased significantly by 11.74% ( P>0.05). Furthermore, SOC and TN increased significantly with natural restoration (NSF) and stabilized by the 25th year. SOC and TN decreased to a minimum approximately during the 7th to 9th year period under artificial vegetation restoration (PF, RF, RPF); SOC and TN recovered to their initial values after approximately 13 to 15 years, and stabilized by the 25th year. Finally, the C:N ratio did not change significantly, while the C:P and N:P ratios varied temporally with early fluctuations (0–10 year period), significant increases in the mid-term (10–20 year period; P < 0.05), and stabilization in the late stage (20–30 year period). Climate indirectly influenced SOC, TN, and TP through soil and vegetation factors. SOC and TN were directly affected by both soil and vegetation factors, while TP was primarily influenced by vegetation factors. Over the 30-year period, the contribution of vegetation factors to soil nutrients gradually increased, with tree and herbaceous biomass being a key factor, while the contribution of soil factors decreased. Our findings provide crucial insights into the long-term effects of vegetation restoration on soil nutrient cycling and stoichiometric optimization in the Loess Plateau and offer a scientific basis for formulating effective restoration strategies.