Background: Soil-transmitted helminth infections have been found to be associated with child development. The objective was to investigate hemoglobin levels and malnutrition as mediators of the association between Ascaris infection and intelligence quotient (IQ) scores in children. Methods: We conducted a longitudinal cohort study in Iquitos, Peru, between September 2011 and July 2016. A total of 1760 children were recruited at 1 year of age and followed up annually to 5 years. We measured Ascaris infection and malnutrition at each study visit, and hemoglobin levels were measured as of age 3. The exposure was defined as the number of detected Ascaris infections between age 1 and 5. We measured IQ scores at age 5 and used Bayesian models to correct exposure misclassification. Results: We included a sample of 781 children in the analysis. In results adjusted for Ascaris misclassification, mean hemoglobin levels mediated the association between Ascaris infection and IQ scores. The natural direct effects (not mediated by hemoglobin) (95% CrI) and natural indirect effects (mediated by hemoglobin) (95% CrI) were compared with no or one infection: -0.9 (-4.6, 2.8) and -4.3 (-6.9, -1.6) for the effect of two infections; -1.4 (-3.8, 1.0) and -1.2 (-2.0, -0.4) for three infections; and -0.4 (-3.2, 2.4) and -2.7 (-4.3, -1.0) for four or five infections. Conclusion: Our results are consistent with the hypothesis that hemoglobin levels mediate the association between Ascaris infection and IQ scores. Additional research investigating the effect of including iron supplements in STH control programs is warranted.