In many science, technology, engineering, and mathematics disciplines, women are outperformed by men in test scores, jeopardizing their success in science-oriented courses and careers. The current study tested the effectiveness of a psychological intervention, called values affirmation, in reducing the gender achievement gap in a college-level introductory physics class. In this randomized double-blind study, 399 students either wrote about their most important values or not, twice at the beginning of the 15-week course. Values affirmation reduced the male-female performance and learning difference substantially and elevated women’s modal grades from the C to B range. Benefits were strongest for women who tended to endorse the stereotype that men do better than women in physics. A brief psychological intervention may be a promising way to address the gender gap in science performance and learning.