To explore differences in the vaginal microbiome between preterm and term deliveries. Nested case-control study in 3D cohort (design, develop, discover). Quebec, Canada. Ninety-four women with spontaneous preterm birth as cases [17 early (<34 weeks) and 77 late (34-36 weeks) preterm birth] and 356 women as controls with term delivery (≥37 weeks). To assess the vaginal microbiome by sequencing the V4 region of the 16S ribosomal RNA (rRNA) gene in swabs self-collected during early pregnancy. Comparison of relative abundance of bacterial operational taxonomic units and oligotypes and identifying vaginal community state types (CSTs) in early or late spontaneous preterm and term deliveries. Lactobacillus gasseri/ Lactobacillus johnsonii (coefficient -5.36, 95% CI -8.07 to -2.65), Lactobacillus crispatus (99%)/ Lactobacillus acidophilus (99%) (-4.58, 95% CI -6.20 to -2.96), Lactobacillus iners (99%)/ Ralstonia solanacearum (99%) (-3.98, 95% CI -6.48 to -1.47) and Bifidobacterium longum/ Bifidobacterium breve (-8.84, 95% CI -12.96 to -4.73) were associated with decreased risk of early but not late preterm birth. Six vaginal CSTs were identified: four dominated by Lactobacillus; one with presence of bacterial vaginosis-associated bacteria (Gardnerella vaginalis, Atopobium vaginae and Veillonellaceae bacterium) (CST IV); and one with nondominance of Lactobacillus (CST VI). CST IV was associated with increased risk of early (4.22, 95% CI 1.24-24.85) but not late (1.63, 95% CI 0.68-5.04) preterm birth, compared with CST VI. Lactobacillus gasseri/L. johnsonii, L. crispatus/L. acidophilus, L. iners/R. solanacearum and B. longum/B. breve may be associated with decreased risk of early preterm birth. A bacterial vaginosis-related vaginal CST versus a CST nondominated by Lactobacillus may be associated with increased risk of early preterm birth. Largest study of its kind finds certain species of vaginal Lactobacillus + Bifidobacterium may relate to lower risk of preterm birth.