Specialization and concomitant trade-offs are assumed to underlie the non-neutral coexistence of lineages. Trade-offs across heterogeneous environments can promote diversity by preventing competitive exclusion. However, the importance of trade-offs in maintaining diversity in natural microbial assemblages is unclear, as trade-offs are frequently not detected in artificial evolution experiments. Stressful conditions associated with patches of heavy-metal enriched serpentine soils provide excellent opportunities for examining how heterogeneity may foster genetic diversity. Using a spatially replicated design, we demonstrate that rhizobium bacteria symbiotic with legumes inhabiting contrasting serpentine and nonserpentine soils exhibit a trade-off between a genotype's nickel tolerance and its ability to replicate rapidly. Furthermore, we detected adaptive divergence in rhizobial assemblages across soil type heterogeneity at multiple sites, suggesting that this trade-off may promote the coexistence of phenotypically distinct bacterial lineages. Trade-offs and adaptive divergence may be important factors maintaining the tremendous diversity within natural assemblages of bacteria.