The microbiota-dependent metabolite trimethylamine-N-oxide (TMAO) has been reported as a novel and independent risk factor for the development of cardiovascular and metabolic diseases, but the association with gestational diabetes mellitus (GDM) remains unclear. The aim of this study was to investigate the association between plasma TMAO concentration and GDM in a 2-phase study. A 2-phase design was used in the current study. An initial phase included 866 participants (433 GDM cases and 433 matched controls) with fasting blood samples collected at the time of GDM screening (24-32 wk of gestation). An independent-phase study, with 276 GDM cases and 552 matched controls who provided fasting blood samples before 20 wk of gestation and who had GDM screened during 24-32 wk of gestation, was nested within a prospective cohort study. These 2 studies were both conducted in Wuhan, China, and the incidence of GDM in the cohort study was 10.8%. Plasma TMAO concentrations were determined by stable isotope dilution liquid chromatography-tandem mass spectrometry. GDM was diagnosed according to the American Diabetes Association criteria by using an oral-glucose-tolerance test. In the initial case-control study, the adjusted OR of GDM comparing the highest TMAO quartile with the lowest quartile was 1.94 (95% CI: 1.28, 2.93). Each SD increment of ln-transformed plasma TMAO was associated with 22% (95% CI: 5%, 41%) higher odds of GDM. In the nested case-control study, women in the highest quartile also had increased odds of GDM (adjusted OR: 2.06; 95% CI: 1.28, 3.31) compared with women in the lowest quartile, and the adjusted OR for GDM per SD increment of ln-transformed plasma TMAO was 1.26 (95% CI: 1.08, 1.47). Consistent findings from this 2-phase study indicate a positive association between plasma TMAO concentrations and GDM. Future studies are warranted to elucidate the underlying mechanisms. This trial was registered at www.clinicaltrials.gov as NCT03415295.