Observational and experimental evidence has revealed the functional importance of microbial diversity. However, the effects of microbial diversity loss on ecosystem functions are not consistent across studies, which are probably tempered by microbial functional redundancy, specific taxa and functions evaluated. Here we conducted diversity manipulation experiments in two independent soils with distinct prokaryotic communities, and investigated how the initial community traits (e.g., distinct functional redundancy and taxonomic composition) modulate the contribution of prokaryotic diversity loss and composition shift to eight ecosystem functions related to soil nutrient cycling. We found that diversity loss impaired three functions (potential nitrification rate, N2 -fixation activity and phosphatase) and multifunctionality only in the communities with low functional redundancy, but all examined functions were unaffected in the communities with high functional redundancy. All significantly affected functions belonged to specialized functions, while the broad function (soil basal respiration) was unaffected. Moreover, prokaryotic composition explained more functional variation than diversity, which was ascribed to the crucial role of specific taxa that influence particular functions. Taken together, this study provides empirical evidence for identifying the mechanism underlying the ecosystem response to changes in microbial community, with implications for improving the prediction of ecosystem process models and managing microbial communities to promote ecosystem services.