The objective of this study is to determine if minority and female students are more likely to persist in a science, technology, engineering, and math (STEM) major when they enroll in classes taught by instructors of their own race or gender. I utilize within institution variation of the number of black and female instructors assigned to teach introductory STEM courses to account for systematic differences between black and female students who sort into classes taught by instructors with similar racial or gender characteristics. Results indicate that black students are more likely to persist in a STEM major if they have a STEM course taught by a black instructor. Similar to previous findings, female students are no more likely to persist when more of their STEM courses are taught by female instructors. These results suggest that policies to increase the minority representation among faculty members might also be an effective means of increasing the representation of minorities who persist and ultimately graduate within STEM fields.