Abstract Background Inequality in preterm birth is a world-wide challenge that has proved difficult for maternity care services to meet. Reducing the inequality requires identification of pregnant women at particularly high risk of preterm birth in order to target interventions. Therefore, the aim was to estimate the risk of preterm birth in women with different combinations of socioeconomic position, mental health conditions, and age. Methods In this nationwide register-based cohort study, we included all first-time mothers that gave birth to a singleton liveborn infant in Denmark between 2000 and 2016. The absolute and relative risk of preterm birth (< 37 weeks of gestation) was examined in different combinations of educational level (high, intermediate, and low) and mental health conditions (no, minor, and moderate/severe) in three age strata (≤23, 24–30, and ≥ 31 years). We estimated the relative risk using Poisson regression with a robust error variance. As additive interaction can help identify subgroups where limited resources can be of best use, we measured the attributable proportion to assess the risk that is due to interaction of the different exposures. Results Of the 415,523 included first-time mothers, 6.3% gave birth prematurely. The risk of preterm birth increased with decreasing educational level and increasing severity of mental health conditions in all age strata, but most in women aged ≥31 years. The highest absolute risk was 12.9% [95% CI: 11.2;14.8%] in women aged ≥31 years with low education and moderate/severe mental health conditions resulting in a relative risk of 2.23 [95% CI: 1.93–2.58] compared to the unexposed reference group in that age strata. We found positive additive interaction between low education and mental health conditions in women aged 24–30 and ≥ 31 years and between age ≥ 31 years and combinations of mental health conditions and educational levels. Conclusion The inequality in preterm birth increased with increasing age. To reduce inequality in preterm birth focused attention on women with higher age further combined with lower educational levels and mental health conditions is essential.