The exchange of material and individuals between neighbouring food webs is ubiquitous, but theory remains scarce for how such spatial flows affect ecosystem functioning. Here, we combine dynamic food web models with models for nutrient recycling to explore how animal foraging movement, between habitats of contrasting fertility and plant diversity, affects species persistence as well as the stocks and fluxes of biomass, detritus, and nutrients. We found that the net flow of consumers went from the habitat of higher fertility or diversity to the habitat with lower fertility or diversity, boosting ecosystem functioning in the receiving habitat. By explicitly modelling stocks and interconnecting fluxes we could replicate empirically observed effects of spatial subsidies, such as biomass distribution shifts and effect attenuation, and elucidate the underlying mechanisms. Our results demonstrate how foraging movement can drastically alter local functioning. Overall, our approach offers a start toward understanding ecosystem function in human-dominated landscapes.