The positive effects of afforestation in karst rocky desertification areas are often limited by soil nitrogen (N) availability. However, how plant N limitation evolves in response to prolonged afforestation as well as the mechanisms underlying plant N limitation and soil N availability are poorly understood. In this study, plant leaves and soil samples were collected from cropland, Dodonaea viscosa plantations 10, 20 and 40 years after their establishment on abandoned cropland in a karst rocky desertification area. The natural succession of shrubland served as the control. Foliar N/phosphorus (P) stoichiometry was used to evaluate plant N limitation, and the N concentration and δ15N value of foliar and soil were measured to evaluate the changes in soil N availability. Soil N transformation rates were also determined, using 15N tracing technique to elucidate the mechanism underlying soil inorganic N availability. The plant community-level foliar N/P ratio (13.5) was lower than 14 following 10-y afforestation, indicating that plant growth is predominantly N limited. With the prolonged afforestation, the plant community-level foliar N/P ratio increased to 14.0–15.5, suggesting decreased plant N limitation. This could be attributed to increased soil N availability confirmed by the raises in the N concentration and δ15N of plant community-level foliar and soil δ15N with prolonged afforestation. Compared to cropland, D. viscosa afforestation increased the soil inorganic N supply capacity, by stimulating organic N mineralization, heterotrophic nitrification and the release of adsorbed ammonium, more obviously with prolonged afforestation. The rates of mineralization, heterotrophic nitrification and the release of adsorbed ammonium correlated significantly and positively with the plant community-level foliar N concentration, N/P ratio, and δ15N, indicating that a larger soil inorganic N supply alleviates plant N limitation. This effect can be attributed to the increases in organic matter content, bacterial and fungal abundances and soil structure improvement following afforestation, all of which facilitate mineralization and heterotrophic nitrification. However, plant N limitation after 40 years of afforestation still exists, suggesting that monoculture afforestation may need to be adapted to maximize soil N availability and to alleviate plant N limitation in karst rocky desertification areas.