In sand lizards (Lacerta agilis), males with more and brighter nuptial coloration also have more DNA fragments visualized in restriction fragment length polymorphism analysis of their major histocompatibility complex class I loci (and, hence, are probably more heterozygous at these loci). Such males produce more viable offspring, with a particularly strong viability effect on daughters. This suggests that females should adjust both their reproductive investment and offspring sex ratio in relation to male coloration (i.e. differential allocation). Our results show that experimental manipulation of partner coloration in the wild results in significantly higher maternal effort and a 10% higher proportion of daughters than sons. This supports the hypothesis that females increase their maternal energetic expenditure and adjust their offspring sex ratio in response to high-quality partners. However, it also suggests that this has probably evolved through natural selection for increased offspring viability (primarily through production of daughters), rather than through increased mate attraction (e.g. sexy sons).