ImportanceIntravenous magnesium sulfate administered to pregnant individuals before birth at less than 30 weeks’ gestation reduces the risk of death and cerebral palsy in their children. The effects at later gestational ages are unclear.ObjectiveTo determine whether administration of magnesium sulfate at 30 to 34 weeks’ gestation reduces death or cerebral palsy at 2 years.Design, Setting, and ParticipantsThis randomized clinical trial enrolled pregnant individuals expected to deliver at 30 to 34 weeks’ gestation and was conducted at 24 Australian and New Zealand hospitals between January 2012 and April 2018.InterventionIntravenous magnesium sulfate (4 g) was compared with placebo.Main Outcomes and MeasuresThe primary outcome was death (stillbirth, death of a live-born infant before hospital discharge, or death after hospital discharge before 2 years’ corrected age) or cerebral palsy (loss of motor function and abnormalities of muscle tone and power assessed by a pediatrician) at 2 years’ corrected age. There were 36 secondary outcomes that assessed the health of the pregnant individual, infant, and child.ResultsOf the 1433 pregnant individuals enrolled (mean age, 30.6 [SD, 6.6] years; 46 [3.2%] self-identified as Aboriginal or Torres Strait Islander, 237 [16.5%] as Asian, 82 [5.7%] as Māori, 61 [4.3%] as Pacific, and 966 [67.4%] as White) and their 1679 infants, 1365 (81%) offspring (691 in the magnesium group and 674 in the placebo group) were included in the primary outcome analysis. Death or cerebral palsy at 2 years’ corrected age was not significantly different between the magnesium and placebo groups (3.3% [23 of 691 children] vs 2.7% [18 of 674 children], respectively; risk difference, 0.61% [95% CI, −1.27% to 2.50%]; adjusted relative risk [RR], 1.19 [95% CI, 0.65 to 2.18]). Components of the primary outcome did not differ between groups. Neonates in the magnesium group were less likely to have respiratory distress syndrome vs the placebo group (34% [294 of 858] vs 41% [334 of 821], respectively; adjusted RR, 0.85 [95% CI, 0.76 to 0.95]) and chronic lung disease (5.6% [48 of 858] vs 8.2% [67 of 821]; adjusted RR, 0.69 [95% CI, 0.48 to 0.99]) during the birth hospitalization. No serious adverse events occurred; however, adverse events were more likely in pregnant individuals who received magnesium vs placebo (77% [531 of 690] vs 20% [136 of 667], respectively; adjusted RR, 3.76 [95% CI, 3.22 to 4.39]). Fewer pregnant individuals in the magnesium group had a cesarean delivery vs the placebo group (56% [406 of 729] vs 61% [427 of 704], respectively; adjusted RR, 0.91 [95% CI, 0.84 to 0.99]), although more in the magnesium group had a major postpartum hemorrhage (3.4% [25 of 729] vs 1.7% [12 of 704] in the placebo group; adjusted RR, 1.98 [95% CI, 1.01 to 3.91]).Conclusions and RelevanceAdministration of intravenous magnesium sulfate prior to preterm birth at 30 to 34 weeks’ gestation did not improve child survival free of cerebral palsy at 2 years, although the study had limited power to detect small between-group differences.Trial Registrationanzctr.org.au Identifier: ACTRN12611000491965