In many species females prefer major histocompatibility complex (MHC) dissimilar mates, which may improve offspring resistance to pathogens. However, sexual conflict may interfere with female preference when males attempt to mate with all females, regardless of compatibility. Here we used semi-natural spawning channels to examine how mating behaviour and genetic similarity at the MHC class II peptide binding region affected parentage patterns in Chinook salmon (Oncorhynchus tshawytscha). We found that females directed aggression at more MHC-similar males than expected by chance, providing a possible mechanism of female MHC choice in salmon. Males also directed aggression towards MHC-similar females, which was consistent with males harassing unreceptive mates. Males' aggression was positively correlated with their reproductive success, and it appeared to overcome female aversion to mating with MHC-similar males, as females who were the target of high levels of male aggression had lower than expected MHC divergence in their offspring. Indeed, offspring MHC divergence was highest when the sex ratio was female-biased and male harassment was likely to be less intense. These data suggest that male harassment can reduce female effectiveness in selecting MHC-compatible mates, and sexual conflict can thus have an indirect cost to females.