To explore soil organic carbon (SOC) accumulation mechanisms, the dynamics of C functional groups and macroaggregation were studied synchronously through aggregate fractionation and 13 C NMR spectroscopy in sandy loam soil following an 18-year application of compost and fertilizer in China. Compared with no fertilizer control, both compost and fertilizer improved SOC content, while the application of compost increased macroaggregation. Fertilizer application mainly increased the levels of recalcitrant organic C components characterized by methoxyl/N-alkyl C and alkyl C, whereas compost application mainly promoted the accumulation of methoxyl/N-alkyl C, phenolic C, carboxyl C, O-alkyl C and di-O-alkyl C in bulk soil. The preferential accumulation of organic C functional groups in aggregates depended on aggregate size rather than nutrient amendments. These groups were characterized by phenolic C and di-O-alkyl C in the silt €‰+ €‰clay fraction, carboxyl C in microaggregates and phenolic C, carboxyl C and methoxyl/N-alkyl C in macroaggregates. Thus, the differences in accumulated organic C components in compost- and fertilizer-amended soils were primarily attributable to macroaggregation. The accumulation of methoxyl/N-alkyl C in microaggregates effectively promoted macroaggregation. Our results suggest that organic amendment rich in methoxyl/N-alkyl C effectively improved SOC content and accelerated macroaggregation in the test soil.