Fungi provide relevant ecosystem services contributing to primary productivity and the cycling of nutrients in forests. These fungal inputs can be decisive for the resilience of Mediterranean forests under global change scenarios, making necessary an in-deep knowledge about how fungal communities operate in these ecosystems. By using high-throughput sequencing and enzymatic approaches, we studied the fungal communities associated with three genotypic variants of Pinus pinaster trees, in 45-year-old common garden plantations. We aimed to determine the impact of biotic (i.e., tree genotype) and abiotic (i.e., season, site) factors on the fungal community structure, and to explore whether structural shifts triggered functional responses affecting relevant ecosystem processes. Tree genotype and spatial-temporal factors were pivotal structuring fungal communities, mainly by influencing their assemblage and selecting certain fungi. Diversity variations of total fungal community and of that of specific fungal guilds, together with edaphic properties and tree's productivity, explained relevant ecosystem services such as processes involved in carbon turnover and phosphorous mobilization. A mechanistic model integrating relations of these variables and ecosystem functional outcomes is provided. Our results highlight the importance of structural shifts in fungal communities because they may have functional consequences for key ecosystem processes in Mediterranean forests.