Although crucial for the understanding of adaptive evolution, genetically resolved examples of local adaptation are rare. To maximize survival and reproduction in their local environment, hosts should resist their local parasites and pathogens. The major histocompatibility complex (MHC) with its key function in parasite resistance represents an ideal candidate to investigate parasite-mediated local adaptation. Using replicated field mesocosms, stocked with second-generation lab-bred three-spined stickleback hybrids of a lake and a river population, we show local adaptation of MHC genotypes to population-specific parasites, independently of the genetic background. Increased allele divergence of lake MHC genotypes allows lake fish to fight the broad range of lake parasites, whereas more specific river genotypes confer selective advantages against the less diverse river parasites. Hybrids with local MHC genotype gained more body weight and thus higher fitness than those with foreign MHC in either habitat, suggesting the evolutionary significance of locally adapted MHC genotypes.