In this paper we present new evidence on the impact of school characteristics on student achievement using an unusually rich data set from Ghana. We deal with two potentially important selectivity issues in the developing country context: the sorting of higher ability children into better schools, and the high incidence of both delayed school enrollment and early leaving. Our empirical results do not reveal any strong selectivity bias. We also highlight the indirect effects of improving school quality on student achievement through increased grade attainment. A cost-benefit analysis, taking into account these indirect effects, shows that repairing classrooms (a policy option ignored in most education production function studies) is a cost-effective investment in Ghana, relative to providing more instructional materials and improving teacher quality.