We study the impact of classroom rank on children’s learning using a unique experiment from Ecuador. Within each school, students were randomly assigned to classrooms in every grade between kindergarten and 6th grade. Students with the same ability can have different classroom ranks because of the (random) peer composition of their classroom. Children with higher beginning-of-grade classroom rank have significantly higher test scores at the end of that grade. The impact of classroom rank is larger for younger children and grows over time. Higher classroom rank also improves executive function, child happiness, and teacher perceptions of student ability.