Microorganisms are at the center of all major biogeochemical processes on Earth, providing valuable ecosystem services such as nutrient cycling, climate regulation and degradation of organic matter and pollutants. The aim is to address fundamental questions on the causes and consequences of biodiversity within microbial taxa and functional guilds in terrestrial environments. The approach is to implement a functional ecology framework, where microbial communities are defined by the functions they perform. The main focus is microbial communities involved in nitrogen (N) cycling. We use nitrifying and denitrifying microbial communities as model systems to study the link between microbial community dynamics and ecosystem processes, as well as identify key organisms and factors that control N-transformation processes. Microbial communities that mediate different N-cycle processes ultimately determine whether N is gained or lost in an ecosystem. Understanding how abiotic or biotic factors shape the diversity, structure, and functioning of these communities is therefore critical for predicting the fate of N in Earth’s ecosystems. The knowledge is applied to solve specific problems relating to sustainable agriculture and climate change.