BACKGROUND: Racial and ethnic disparities in opioid prescribing in the emergency department (ED) are well described, yet the influence of socioeconomic status (SES) remains unclear. OBJECTIVES: (1) To examine the effect of neighborhood SES on the prescribing of opioids for moderate to severe pain; and (2) to determine if racial disparities in opioid prescribing persist after accounting for SES. DESIGN: We used cross-sectional data from the National Hospital Ambulatory Medical Care Survey between 2006 and 2009 to examine the prescribing of opioids to patients presenting with moderate to severe pain (184 million visits). We used logistic regression to examine the association between the prescribing of opioids, SES, and race. Models were adjusted for age, sex, pain-level, injury-status, frequency of emergency visits, hospital type, and region. MAIN MEASURES: Our primary outcome measure was whether an opioid was prescribed during a visit for moderate to severe pain. SES was determined based on income, percent poverty, and educational level within a patient's zip code. RESULTS: Opioids were prescribed more frequently at visits from patients of the highest SES quartile compared to patients in the lowest quartile, including percent poverty (49.0 % vs. 39.4 %, P<0.001), household income (47.3 % vs. 40.7 %, P < 0.001), and educational level (46.3 % vs. 42.5 %, P=0.01). Black patients were prescribed opioids less frequently than white patients across all measures of SES. In adjusted models, black patients (AOR 0.73; 95 % CI 0.66-0.81) and patients from poorer areas (AOR 0.76; 95 % CI 0.68-0.86) were less likely to receive opioids after accounting for pain-level, age, injury-status, and other covariates. CONCLUSIONS: Patients presenting to emergency departments from lower SES regions were less likely to receive opioids for equivalent levels of pain than those from more affluent areas. Black and Hispanic patients were also less likely to receive opioids for equivalent levels of pain than whites, independent of SES.