We analyse how mental health and socioeconomic inequalities in the Spanish population aged 16–64 years have changed between 2006–2007 and 2011–2012. We observed an increase in the prevalence of poor mental health among men (prevalence ratio = 1.15, 95% CI 1.04–1.26], especially among those aged 35–54 years, those with primary and secondary education, those from semi-qualified social classes and among breadwinners. None of these associations remained after adjusting for working status. The relative index of inequality by social class increased for men from 1.02 to 1.08 (P = 0.001). We observed a slight decrease in the prevalence of poor mental health among women (prevalence ratio = 0.92, 95% CI 0.87–0.98), without any significant change in health inequality.