Abstract
Urban agroforestry ecosystems, formed by the intermixing of croplands and urban forests, play a crucial role in enhancing ecological resilience and supporting sustainable landscape management. However, how different proportions of forest and farmland contribute to ecosystem multifunctionality and modify interactions among ecosystem services (ESs) remains insufficiently understood, particularly within rapidly urbanizing environments. In this study, we quantified four keys-grain production, water conservation, soil retention, and carbon sequestration-across urban–rural agroforestry compositions in Changchun City, Northeast China. Using multisource satellite products and biophysical models, we assessed spatiotemporal changes in ES supply, evaluated multifunctionality across five agroforestry composition types, and examined trade-offs and synergies among ESs. The results show clear spatial differentiation driven by the urban-rural forest gradient. Among the five compositions, multifunctionality was lowest in the agricultural area (AA, farmland > 80%), while in mixed urban agroforestry zones-including agriculture-forest area (AFA, farmland > 60% and forest > 20%), agriculture–forest balance area (AFBA, farmland > 40% and forest > 40%), forest-agriculture area (FAA, farmland > 20% and forest > 60%), and forest area (FA, forest > 80%)-multifunctionality declined progressively as forest proportion increased. Strong synergy between grain production and water conservation was observed in AA, whereas in the other compositions, soil retention and water conservation formed the dominant synergistic pair, with synergy slightly strengthening as forest percentage increased. Notably, in FA, the relationship between grain production and soil retention shifted from synergy to trade-off, reflecting functional shifts along the urban forest gradient. These findings provide a scientific basis for optimizing the spatial configuration of urban forests and farmlands, and support nature-based solutions and integrated landscape planning aimed at balancing food security and ecological sustainability in urbanizing regions. SUPPLEMENTARY INFORMATION: The online version contains supplementary material available at 10.1038/s41598-026-37986-x.