We designed a retrospective cohort study of first-year medical students to assess the impact of a community-based primary care course, Introduction to Primary Care (IPC), on residency choice. In the group that took IPC (n=282), 48.2% entered generalist residencies (internal medicine, pediatrics, family medicine, or medicine/pediatrics), compared to 38.2% in the group that wanted IPC (n=398) and 39.6% in the group that did not want IPC (n=245). Controlling for gender, students who took IPC had a 40% higher odds of selecting a generalist residency than those who wanted to take IPC (odds ratio [OR], 1.42; 95% confidence interval [CI], 1.04 to 1.95). There was no difference between those who wanted IPC and those who did not (OR, 1.08; CI, 0.78 to 1.52). The community-based primary care experience was positively associated with students' selection of generalist residencies.