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 district-level administrative data of mining taxes redistributed to local governments, we find sizable effects on student learning from the redistribution. However, and consistent with recent political economy models, the relationship is non-monotonic. Based on these models, we identify improvements in school expenditure and infrastructure, together with increases in health outcomes of adults and children, as key mechanisms explaining the effect we find for redistribution. Policy implications for the avoidance of the natural resource curse are discussed.