Abstract Observed biodiversity–ecosystem function (BEF) relationships are highly variable, particularly in natural forests. However, our understanding of the factors that generate these often contradictory patterns, especially the role of different mycorrhizal associations, is still limited. By relating tree species richness and above‐ground biomass (AGB) in a fully mapped 24‐ha subtropical forest dynamics plot, we evaluated the impacts of soil fertility and tree mycorrhizal type in mediating BEF relationships at multiple spatial scales. Our results demonstrate a highly positive total richness effect on AGB for arbuscular mycorrhizal (AM) trees but a negative effect on AGB for ectomycorrhizal (EcM) trees, and their relationships were highly spatial scale dependent. However, the observed BEF relationships turned into positive at small spatial scales (i.e. 10 and 20 m) after controlling for other confounding factors (i.e. topography, soil fertility and AM proportion). In addition, we found significant interactions between soil fertility and species richness on AGB. Specifically, the positive effect of total species richness on AGB for major mycorrhizal types gradually weakened with increasing soil fertility, while the positive effect of EcM species richness on AM AGB gradually enhanced at small spatial scales, suggesting the observed diversity effects can be largely attributed to resource niche complementarity and the role of EcM fungi. Synthesis. We conclude that the variable BEF relationships among forest communities could be explained by spatial variation in abiotic environments and community mycorrhizal composition because different types of symbionts perform different nutrient uptake strategies and ability in protection from antagonists. Our findings provide novel insights into the understanding of the variation in the shape of BEF relationships in natural forests, which is critical for forest management, conservation and restoration in a changing world.