Objectives To examine the relationship between infant feeding and risk of child overweight and obesity across race and ethnicity in a diverse community-based cohort. Methods 2172 mother baby dyads were drawn from a prospective cohort constructed using data from electronic medical records linked to birth records. The primary exposure was exclusive breastfeeding at 2 months of age; outcome was BMI Z-score and BMI ≥ 85th percentile (overweight and obese) at 4 years of age. Regression models were adjusted for confounding using covariance balanced propensity score and inverse probability weighting. Results At age 4, exclusively breast fed children had lower BMI Z-score (-0.109, SE = 0.048) and a decreased odds of a BMI ≥ 85th percentile (0.832; 95 % CI 0.792, 0.994), when compared to those exclusively formula-fed or had mixed feeding. Race and ethnicity significantly moderated these associations. Sub-population analysis showed the effect was significant for BMI Z-score (p = 0.0002) and BMI ≥ 85th percentile (p < 0.0001) only for children of NH white mothers. For children of NH black mothers exclusive breastfeeding was not associated with a significant difference in BMI Z-score, however there was an increased odds of overweight or obesity (p = 0.0145). Conclusions The protective effect of breastfeeding against early childhood overweight and obesity may differ by race and ethnicity. This suggests that programs aiming to reduce obesity by increasing rates of breastfeeding may have limited impact for some groups and should be coupled with other racially and ethnically focused efforts to encourage healthy feeding practices in infancy and early childhood.