Women outnumber men in undergraduate enrollments, but they are much less likely than men to major in mathematics or science or to choose a profession in these fields. This outcome often is attributed to the effects of negative sex-based stereotypes. We studied the effect of such stereotypes in an experimental market, where subjects were hired to perform an arithmetic task that, on average, both genders perform equally well. We find that without any information other than a candidate's appearance (which makes sex clear), both male and female subjects are twice more likely to hire a man than a woman. The discrimination survives if performance on the arithmetic task is self-reported, because men tend to boast about their performance, whereas women generally underreport it. The discrimination is reduced, but not eliminated, by providing full information about previous performance on the task. By using the Implicit Association Test, we show that implicit stereotypes are responsible for the initial average bias in sex-related beliefs and for a bias in updating expectations when performance information is self-reported. That is, employers biased against women are less likely to take into account the fact that men, on average, boast more than women about their future performance, leading to suboptimal hiring choices that remain biased in favor of men.