Sustainable agriculture relies on the use of herbicides to preserve soil carbon and minimize disturbance to the soil structure. Glyphosate and atrazine, widespread and frequently used herbicides in South America, can affect soil microbial populations involved in nutrient recycling. In this work, the effect of commercial glyphosate and atrazine on denitrifying and diazotrophic populations has been compared. A soil without a history of previous herbicide application was incubated with one or several doses of herbicide, which was monitored along the experiment, and the microbial rate of denitrification and N2 fixation, the abundance of specific genes nirS, nirK, nosZ, nifH and the community structure of diazotrophs were analyzed. One dose of glyphosate or atrazine increased by 55% and 54%, respectively, the rate of N2 fixation and significantly reduced the rate of N2O production by incomplete denitrifiers. Long time exposure to glyphosate increased the abundance of nirK, nosZ, and nifH genes, but atrazine significantly reduced the nosZ gene density. Remarkably, diazotrophs belonging to the Bradyrhizobium genus, predominant in this soil, constituted a resilient population that became enriched after incubation with glyphosate or atrazine. Therefore, short and long-exposure to glyphosate and atrazine modifies the performance and survival of diazotrophs and denitrifiers in soil impacting the N biogeochemical cycle and the soil quality.