This article seeks to identify the factors associated with a longer duration of breastfeeding. A nested case-control study was carried out with a cohort of mothers for about two years after they gave birth to their children in the two largest public maternity hospitals in João Pessoa - PB. Mothers who breastfed up to 15 months were considered as cases (n = 55) and those who breastfed for more than 15 months (n = 48) were considered controls. The exposure variables were maternal socioeconomic characteristics, gestational characteristics, birth characteristics and early introduction of food. The Chi-Square test was applied to select the independent variables (p-value <= 0.20) to be entered into a multiple logistic regression model, with only those with a p-value <= 0.05 being kept in the final model. The early introduction of infant formula (OR = 4.71, CI95%: 1.76 - 12.63), other milks (OR = 3.25, CI95%: 1.27 - 8.31) and having less than six prenatal consultations (OR = 2.73, CI95%: 1.04 - 7.07) were risk factors for a shorter breastfeeding duration. The early introduction of infant formulas or other milks may be an important indicator for the adoption of appropriate breastfeeding promotion and support actions to achieve the WHO target of breastfeeding for two years or longer.