Intercropping tree legumes with forage grasses in a silvopastoral system can avoid pasture degradation benefiting the soil. In such a system, nitrogen (N) is supplied by symbiosis between legumes and bacteria. However, the pasture quality determines the action of free-living nitrogen-fixing bacteria, which possess nifH genes, which encode nitrogenase enzyme. Ammonium-oxidizing bacteria (AOB), involved in the nitrification step, can be evaluated by specific regions of the 16S rRNA corresponding to AOB. Thus, we investigated the influence of the introduction of tree legumes into a silvopastoral system on the community structure and abundance of total bacteria, diazotrophic bacteria and ammonium-oxidizing bacteria by DGGE (denaturing gradient gel electrophoresis) and real-time qPCR (quantitative PCR). The experiment involved nine plots of one hectare each, planted with sabia (Mimosa caesalpinifolia), a Gliricidia species (Gliricidia sepium), and a Brachiaria species (Brachiaria decumbens) in a randomized block design, forming three treatments: I-Brachiaria intercropped with sabia; II-Brachiaria intercropped with Gliricidia and III-Brachiaria only, with three replicates. The structures of the total bacterial and ammonium-oxidizing bacterial communities were influenced by tree legume introduction, possibly through modification of the soil chemical attributes. The copy numbers of total bacteria, ammonium-oxidizing bacteria and diazotrophic bacteria were higher in soils planted with legumes, which provided better conditions for microbial growth compared to planting with the Brachiaria species alone. Silvopastoral management with tree legumes improves the biological quality of soil, favouring the bacterial community linked to N-cycling.