Using a theoretical model where students care about achievement rank, I study effort choices in the classroom and show that rank concerns generate peer effects. The model’s key empirical prediction is that the effect on own achievement of increasing the dispersion in peer cost of effort is heterogeneous, depending on a student’s own cost of effort. To test this, I construct a longitudinal multi-cohort dataset of students, with data on the geographic propagation of building damages from the Chilean 2010 earthquake. I find that higher dispersion in home damages among one’s classmates led, on average, to lower own Mathematics and Spanish test scores. To be able to test the theory, I develop a novel nonlinear difference-in-differences model that estimates effect heterogeneity and that relates observed damages to unobserved cost of effort. I find that some students at the tails of the predicted cost of effort distribution benefit from higher dispersion in peer cost of effort, as predicted by the theoretical model. This finding suggests that observed peer effects on test scores are, at least partly, governed by rank concerns.