Women in Britain are recommended to exclusively breastfeed for six months but many drop it within the first month saying they lacked support when they had difficulties.

The study, published in the journal Pediatrics, said: "By looking at boys and girls independently, we found that predominant breastfeeding for six months or longer was significantly associated with increased mathematics, reading, writing, and spelling scores for boys, but no effect of breastfeeding was apparent on the educational attainment of girls for any subject.

"We found significant interactions for mathematics and spelling revealing that boys were more likely than girls to have improved academic scores if they were breastfed for a longer period.

"On average, boys had poorer numeracy and literacy scores than girls; however, the scores were improved if the child was breastfed for six months or longer."

Just over 1,000 children were involved in the study and were followed from when their mothers were 18 weeks pregnant until they reached ten years of age when they were assessed using standard mathematics, reading, writing and spelling scores.

The authors adjusted for other factors that could influence educational attainment, including mother's education and household income. However they could not fully account for mother's intelligence.

Lead author Dr Wendy Oddy, from the Centre for Child Health Research at University of Western Australia, in Perth, wrote in the journal: "The positive effect of predominant breastfeeding for six months or longer on academic achievement can be viewed as shifting the mean population score upward, particularly for boys.

"Our study adds to growing evidence that breastfeeding for at least six months has beneficial effects on optimal child development. Mothers should be encouraged to breastfeed for six months and beyond."

Cathy Warwick, general secretary of the Royal College of Midwives, said: "This is a difficult area to research because of the need to allow for all of the possible variables that influence educational attainment.

"However this study has controlled for these as far as possible and adds to the growing body of evidence that breast feeding is the best way to feed babies from birth to six months of age and beyond.

"It is vital that in the light of this evidence women and their families are given the highest quality of information antenatally and excellent support to breast feed postnatally. It is worrying that recent reviews of the support women are getting suggest that this is one aspect of maternity services where resources are lacking and care provision needs to improve."