Prenatal exposure to rare earth elements (REEs) may contribute to adverse birth outcomes in previous studies. Cord blood vitamin D has been suggested to modify or mediate the effects of environmental exposures. However, none has investigated these roles of cord blood vitamin D in the associations of prenatal exposure to REEs with fetal growth. Maternal trimester-specific urinary concentrations of 13 REEs, cord blood total 25-hydroxyvitamin D at delivery, and birth weight (BW)-for-gestational age (GA) were determined in 710 mother-newborn pairs from Wuhan, China. Higher maternal average urinary concentrations of europium (Eu), gadolinium (Gd), dysprosium (Dy), holmium (Ho), erbium (Er), and ytterbium (Yb) across three trimesters, either individually or jointly, were significantly associated with lower BW-for-GA Z-scores and higher odds of small for gestational age (SGA) [β = −0.092; 95 % confidence interval (CI): −0.149, −0.035 for BW-for-GA Z-scores, and odds ratio = 1.60; 95 % CI: 1.14, 2.24 for SGA involved in each unit increase in weighted quantile sum index of REEs mixture]. When stratified by cord blood vitamin D levels, the associations mentioned above persisted in participants with relatively low vitamin D levels (<13.94 μg/L, the first tertile of distribution), but not among those with relatively high levels (≥13.94 μg/L) (all p-values for interaction < 0.05). The mediation analyses taking account of exposure-mediator interaction showed that the relationships between REEs (as individual and mixture) exposure and lower BW-for-GA were partly mediated through decreasing cord blood vitamin D levels. The proportions mediated by cord blood vitamin D levels were 24.48 % for BW-for-GA Z-scores and 29.05 % for SGA corresponding to the REEs mixture exposure. Conclusively, our study revealed that prenatal exposures to Eu, Gd, Dy, Ho, Er, and Yb were related to fetal growth restriction. Cord blood vitamin D might alleviate toxic effects of these REEs and its reduction might partly mediate REE-induced fetal growth restriction.