Laboratory studies on associations between disease resistance and susceptibility and major histocompatibility (MH) genes in Atlantic salmon Salmo salar have shown the importance of immunogenetics in understanding the capacity of populations to fight specific diseases. However, the occurrence and virulence of pathogens may vary spatially and temporally in the wild, making it more complicated to predict the overall effect that MH genes exert on fitness of natural populations and over several life-history stages. Here we show that MH variability is a significant determinant of salmon survival in fresh water, by comparing observed and expected genotype frequencies at MH and control microsatellite loci at parr and migrant stages in the wild. We found that additive allelic effects at immunogenetic loci were more likely to determine survival than dominance deviation, and that selection on certain MH alleles varied with life stage, possibly owing to varying pathogen prevalence and/or virulence over time. Our results highlight the importance of preserving genetic diversity (particularly at MH loci) in wild populations, so that they have the best chance of adapting to new and increased disease challenges as a result of projected climate warming and increasing aquaculture.