Background: Inadequate water and sanitation adversely affect the health of children in developing countries. We aimed to assess the effects of water and sanitation on childhood health in a birth cohort of Peruvian children. Methods: We followed up children once a day for diarrhoea and once a month for anthropometry, and obtained data for household water and sanitation at baseline. Findings: At 24 months of age, children with the worst conditions for water source, water storage, and sanitation were 1.0 cm (95% CI 0.1-0.8) shorter and had 54% (-1 to 240) more diarrhoeal episodes than did those with the best conditions. Children from households with small storage containers had 28% (1-63) more diarrhoeal episodes than did children from households with large containers. Lack of adequate sewage disposal explained a height deficit of 0.9 cm (0.2-1.7) at 24 months of age. Better water source alone did not accomplish full health benefits. In 24-month-old children from households with a water connection, those in households without adequate sewage disposal and with small storage containers were 1.8 cm (0.1-3.6) shorter than children in households with sewage and with large storage containers. Interpretation: Our findings show that nutritional status is a useful endpoint for water and sanitation interventions and underscores the need to improve sanitation in developing countries. Improved and more reliable water sources should discourage water storage at risk of becoming contaminated, decrease diarrhoeal incidence, and improve linear growth in children.