We exploit time and spatial variation generated by the commodities boom to measure the effect of natural resources on human capital formation in Peru, a country with low governance indicators. Combining test scores from over two million students and districtlevel administrative data on mining production and the redistribution of mining taxes to local governments, we find no effect from production. However, redistribution of mining taxes increases math test scores by 0.23 standard deviations. We identify the improvements in the quality of teachers and in school infrastructure, together with increases in adult employment and health outcomes of adults and children, as key mechanisms from the redistribution. Policy implications for the avoidance of the natural resource curse are discussed.