Preterm birth and socioeconomic status (SES) are associated with brain structure in childhood, but the relative contributions of each during the neonatal period are unknown. To investigate associations of birth gestational age (GA) and SES with neonatal brain morphology by testing 3 hypotheses: GA and SES are associated with brain morphology; associations between SES and brain morphology vary with GA; and associations between SES and brain structure and morphology depend on how SES is operationalized. This cohort study recruited participants from November 2016 to September 2021 at a single center in the United Kingdom. Participants were 170 extremely and very preterm infants and 91 full-term or near-term infants. Exclusion criteria were major congenital malformation, chromosomal abnormality, congenital infection, cystic periventricular leukomalacia, hemorrhagic parenchymal infarction, and posthemorrhagic ventricular dilatation. Birth GA and SES, operationalized at the neighborhood level (using the Scottish Index of Multiple Deprivation), the family level (using parental education and occupation), and subjectively (World Health Organization Quality of Life measure). Brain volume (85 parcels) and 5 whole-brain cortical morphology measures (gyrification index, thickness, sulcal depth, curvature, surface area) at term-equivalent age (median [range] age, 40 weeks, 5 days [36 weeks, 2 days to 45 weeks, 6 days] and 42 weeks [38 weeks, 2 days to 46 weeks, 1 day] for preterm and full-term infants, respectively). Participants were 170 extremely and very preterm infants (95 [55.9%] male; 4 of 166 [2.4%] Asian, 145 of 166 [87.3%] White) and 91 full-term or near-term infants (50 [54.9%] male; 3 of 86 [3.5%] Asian, 78 of 86 [90.7%] White infants) with median (range) birth GAs of 30 weeks, 0 days (22 weeks, 1 day, to 32 weeks, 6 days) and 39 weeks, 4 days (36 weeks, 3 days, to 42 weeks, 1 day), respectively. In fully adjusted models, birth GA was associated with a higher proportion of brain volumes (27 of 85 parcels [31.8%]; β range, -0.20 to 0.24) than neighborhood-level SES (1 of 85 parcels [1.2%]; β = 0.17 [95% CI, -0.16 to 0.50]) or family-level SES (maternal education: 4 of 85 parcels [4.7%]; β range, 0.09 to 0.15; maternal occupation: 1 of 85 parcels [1.2%]; β = 0.06 [95% CI, 0.02 to 0.11] respectively). There were interactions between GA and both family-level and subjective SES measures on regional brain volumes. Birth GA was associated with cortical surface area (β = 0.10 [95% CI, 0.02 to 0.18]) and gyrification index (β = 0.16 [95% CI, 0.07 to 0.25]); no SES measure was associated with cortical measures. In this cohort study of UK infants, birth GA and SES were associated with neonatal brain morphology, but low GA had more widely distributed associations with neonatal brain structure than SES. Further work is warranted to elucidate the mechanisms underlying the association of both GA and SES with early brain development.