Long-term soil age gradients are useful model systems to study how changes in nutrient limitation shape communities of plant root mutualists because they represent strong natural gradients of nutrient availability, particularly of nitrogen (N) and phosphorus (P). Here, we investigated changes in the dinitrogen (N)-fixing bacterial community composition and diversity in nodules of a single host legume (Acacia rostellifera) across the Jurien Bay chronosequence, a retrogressive 2 million-year-old sequence of coastal dunes representing an exceptionally strong natural soil fertility gradient. We collected nodules from plants grown in soils from five chronosequence stages ranging from very young (10s of years; associated with strong N limitation for plant growth) to very old (> 2,000,000 years; associated with strong P limitation), and sequenced the nifH gene in root nodules to determine the composition and diversity of N-fixing bacterial symbionts. A total of 335 unique nifH gene operational taxonomic units (OTUs) were identified. Community composition of N-fixing bacteria within nodules, but not diversity, changed with increasing soil age. These changes were attributed to pedogenesis-driven shifts in edaphic conditions, specifically pH, exchangeable manganese, resin-extractable phosphate, nitrate and nitrification rate. A large number of common N-fixing bacteria genera (e.g. Bradyrhizobium, Ensifer, Mesorhizobium and Rhizobium) belonging to the Rhizobiaceae family (α-proteobacteria) comprised 70% of all raw sequences and were present in all nodules. However, the oldest soils, which show some of the lowest soil P availability ever recorded, harboured the largest proportion of unclassified OTUs, suggesting a unique set of N-fixing bacteria adapted to extreme P limitation. Our results show that N-fixing bacterial composition varies strongly during long-term ecosystem development, even within the same host, and therefore rhizobia show strong edaphic preferences.