Climate change is a potential threat to soil organic carbon (SOC) in semiarid ecosystems. Several studies advocated afforestation as an important way to achieve soil C accumulation, but few deal with the mechanisms of C stabilization. The knowledge of these mechanisms is a key aspect in the preservation of SOC in the face of climate change. In a long-term experiment in southeast Spain, we analyzed the effect on C sequestration and stabilization mechanisms of two Pinus halepensis afforestation treatments: (a) terracing (T) and (b) terracing with soil amendment (AT). Twenty years after installing the pine plantations, changes were measured in: (a) chemical, physical, and biological soil properties, (b) ecosystem C stocks, and (c) three functional SOC pools: particulate organic matter (POM), sand and stable aggregates (S+A), and silt plus clay (S+C). The results show that the afforestation treatment had a distinct impact on soil properties. Compared with the adjacent native shrubland, the AT treatment led to improved soil fertility, while the T treatment had a negative impact on soil properties. In turn, AT led to a C gain in the ecosystem of 1.3kgCm−2, while with T there was a decline of 0.60kgCm−2 over 20years. This decline was due to the impact of the terracing work. The potential ecosystem C sequestration capacity of the afforestation was 160 and 65gCm−2year−1 in AT and T, respectively. Focusing on sequestration in the mineral soil, the average annual sequestration rate was 28gCm−2year−1 in AT and 17gCm−2year−1 in T. In relation to the functional SOC pools, the C sequestered showed the following distribution: 30% POM, 46% (S+A), and 24% (S+C). The results show that C sequestration, through afforestation of semiarid areas, can be increased by using suitable afforestation techniques. Site preparation involving large soil disturbance is not recommended. Twenty years after planting, the potential capacity for C sequestration of the afforested ecosystems is far from being saturated and they will continue sequestering C as they reach maturity.