Variation in phenotypic traits that contribute to fitness influences a population's evolutionary response and its impact on ecosystem function following environmental change, yet its amount and nature are rarely known. Here, we investigated variation in nitrogen (N) fixation activity and its genetic basis for a random sample of laboratory strains of the cyanobacterium Mastigocladus laminosus from a N-limited, geothermally influenced stream in Yellowstone National Park. In a linear mixed-effects model, temperature and genetic differences among strains were the most important factors explaining variation in activity. Genome-wide analyses of genetic divergence between groups of strains that varied in N fixation activity revealed that few loci were strongly associated with these phenotypic differences. Notably, a single nonsynonymous polymorphism in the sulfate assimilation gene apsK explained >25% of the variation in activity at high temperature. We further identified a role for allelic variation of multiple terminal cytochrome oxidases for different aspects of N fixation. In addition, genomes of strains that fixed the most N overall contained a nonsense mutation in a histidine kinase gene that is expected to disrupt normal protein function and may result in transcriptional rewiring. This study illustrates how taking complementary approaches to link phenotype and genotype can inform our understanding of microbial population diversity.