The study, by researchers in the UK and Spain, found that mothers who planned to breastfeed and who actually went on to breastfeed were around 50 per cent less likely to become depressed than mothers who had not planned to, and who did not, breastfeed.
Mothers who planned to breastfeed, but who did not go on to breastfeed, were over twice as likely to become depressed as mothers who had not planned to, and who did not, breastfeed.
The relationship between breastfeeding and depression was most pronounced when babies were 8 weeks old, but much smaller when babies were 8 months or older.
The research used data drawn from the Avon Longitudinal Survey of Parents and Children (ALSPAC), a study of 13,998 births in the Bristol area in the early 1990s.
Maternal depression was measured using the Edinburgh Postnatal Depression Scale when babies were 8 weeks, and 8, 21 and 33 months old.
Depression was also assessed at two points during pregnancy, enabling the researchers to take into account mothers' pre-existing mental health conditions.
"Breastfeeding has well-established benefits to babies, in terms of their physical health and cognitive development; our study shows that it also benefits the mental health of mothers," said Dr Maria Iacovou, from the University of Cambridge's Department of Sociology and a Bye Fellow at Fitzwilliam College.
"In fact, the effects on mothers' mental health that we report in this study are also likely to have an impact on babies, since maternal depression has previously been shown to have negative effects on many aspects of children's development," Iacovou said.
The study was carried out in collaboration with Dr Almudena Sevilla from Queen Mary University of London and Cristina Borra from Universidad de Sevilla, Spain.