Selection response of parents to low school quality, for instance large class sizes, is a major problem when estimating causal class-size effects, also in experimental and quasi-experimental studies. To address this problem a new identification strategy using within-school variation over time in the size of subject-specific classes is proposed. It provides random class-size variation and enables tests for possible selection using test scores in other subjects. Applying this approach to Danish administrative data, highly significant and substantial positive effects of reducing class size are found on examination marks in French. Effects are larger for academically weak students and for boys.