This paper uses the OECD's Program for International Student Assessment student-level achievement database for Mexico to estimate state education production functions, controlling for student characteristics, family background, home inputs, resources, and institutions. The authors take advantage of the state-level variation and representative sample to analyze the impact of institutional factors such as state accountability systems and the role of teachers' unions in student achievement. They argue that accountability, through increased use of state assessments, will improve learning outcomes. The authors also cast light on the role of teachers' unions, namely their strength through appointments to the school and relations with state governments. The analysis shows the importance of good relations between states and unions. Furthermore, it demonstrates that accountability systems are cost-effective measures for improving outcomes.