Cross-sectional studies of the relationship between helminth infection and cognitive function can be informative in ways that treatment studies cannot. However, interpretation of results of many previous studies has been complicated by the failure to control for many potentially confounding variables. We gave Tanzanian schoolchildren aged 9–14 a battery of 11 cognitive and three educational tests and assessed their level of helminth infection. We also took measurements of an extensive range of potentially confounding or mediating factors such as socioeconomic and educational factors, anthropometric and other biomedical measures. A total of 272 children were moderately or heavily infected with Schistosoma haematobium, hookworm or both helminth species and 117 were uninfected with either species. Multiple regression analyses, controlling for all confounding and mediating variables, revealed that children with a heavy S. haematobium infection had significantly lower scores than uninfected children on two tests of verbal short-term memory and two reaction time tasks. In one of these tests the effect was greatest for children with poor nutritional status. There was no association between infection and educational achievement, nor between moderate infection with either species of helminth and performance on the cognitive tests. We conclude that children with heavy worm burdens and poor nutritional status are most likely to suffer cognitive impairment, and the domains of verbal short-term memory and speed of information processing are those most likely to be affected.