Objective: Sociodemographic factors may affect adherence to specific dietary patterns during pregnancy. The present study aimed to identify dietary patterns during pregnancy and associated factors among Brazilian pregnant women. Design: A cross-sectional analysis. Dietary intake was evaluated with a semiquantitative FFQ during the first postpartum week; the time frame included the second and third gestational trimesters. Principal component analysis was used to identify dietary patterns during pregnancy. Sociodemographic data were obtained using a structured questionnaire. Multiple linear regressions were applied to test the associations between the sociodemographic factors and dietary patterns. Setting: Mesquita, Rio de Janeiro, Brazil, 2011. Subjects: Postpartum women (n 327) who were 18-45 years of age and Mesquita residents. Results: Three different dietary patterns were identified: 'healthy' (mainly comprising legumes, vegetables and fruits), 'mixed' (mainly comprising candy, butter and margarine, and snacks) and 'traditional' (mainly comprising beans and rice). Women with a higher monthly per capita family income (β = 0·0006; 95 % CI 0·0001, 0·001; P = 0·011) and women of older age (β = 0·021; 95 % CI −0·001, 0·042; P = 0·058) were more likely to adhere to the 'healthy' dietary pattern. Women with higher parity were less likely to adhere to the 'healthy' pattern (β = − 0·097; 95 % CI −0·184, −0·009; P = 0·030) and were more likely to adhere to the 'traditional' pattern (β = 0·098; 95 % CI 0·021, 0·175; P = 0·012). Although not statistically significant, older women were less likely to adhere to the 'mixed' (β = − 0·017; 95 % CI −0·037, 0·003; P = 0·075) and 'traditional' (β = − 0·018; 95 % CI −0·037, 0·001; P = 0·061) dietary patterns. Conclusions: Monthly per capita family income, parity and maternal age were factors associated with adherence to a healthy diet during pregnancy.