Many college students abandon their goal of completing a degree in STEM when confronted with challenging introductory-level science courses. In the U.S., this trend is more pronounced for underrepresented minority (URM) and first-generation (FG) students, and contributes to persisting racial and social-class achievement gaps in higher education. Previous intervention studies have focused exclusively on race or social class, but have not examined how the two may be confounded and interact. This research therefore investigates the independent and interactive effects of race and social class as moderators of an intervention designed to promote performance, measured by grade in the course. In a double-blind randomized experiment conducted over four semesters of an introductory biology course (N = 1040), we tested the effectiveness of a utility-value intervention in which students wrote about the personal relevance of course material. The utility-value intervention was successful in reducing the achievement gap for FG-URM students by 61%: the performance gap for FG-URM students, relative to CG-Majority students, was large in the control condition, .84 grade points (d = .98), and the treatment effect for FG-URM students was .51 grade points (d = 0.55). The UV intervention helped students from all groups find utility value in the course content, and mediation analyses showed that the process of writing about utility value was particularly powerful for FG-URM students. Results highlight the importance of examining the independent and interactive effects of race and social class when evaluating interventions to close achievement gaps and the mechanisms through which they may operate.