Objective: to analyze the relationship between maternal self-efficacy to breastfeed and sociodemographic, obstetric, and neonatal variables; between the duration of exclusive breastfeeding and sociodemographic variables; and between the breastfeeding self-efficacy and the duration of exclusive breastfeeding at the intervals of 30, 60, and 180 days postpartum. Method: a longitudinal and prospective study conducted with 224 women. A sociodemographic questionnaire, the Breastfeeding Self-Efficacy Scale – Short Form, and a questionnaire on breastfeeding and child feeding were used for collecting the data. Fisher’s exact test and Pearson’s correlation coefficient test were used for analysis. Results: there was no association between breastfeeding self-efficacy and the duration of exclusive breastfeeding identified at 30, 60, and 180 days. Self-efficacy was associated with the type of delivery and complications in the postpartum period. There was also an association between religion and exclusive breastfeeding 30 and 60 days postpartum, and assistance with baby care and exclusive breastfeeding at 60 days. Conclusion: It was identified that the type of delivery, complications in the postpartum period, religion, and assistance with baby care corroborate to increase maternal confidence in the ability to breastfeed.