The fungal communities of grassland soils in Spain from four sites at different elevations were studied. Each site contained grazed and fenced ungrazed plots. These plots were situated in two slope positions (upper and lower zones). The ungrazed plots, fenced off 6 y before the sampling, were part of a study of global change that simulates conditions of rural abandonment, which is widespread in Iberian countries, since Spain joined the European Union. We analyzed the structure of the soil fungi communities and its relationship with herbaceous vegetation. The distribution of 207 taxa of fungi revealed that the elevation was the main factor of fungal variability; the effect of grazing and slope position were associated with less variability. Although a halt in grazing resulted in the accumulation of standing plants and plant litter in these ecosystems, it had relatively little effect on soil microfungi and appeared to be related mainly to growing conditions affected by that accumulation.