The present study investigated gender differences in scholastic achievement (school grades in sciences and languages) as mediated by reasoning ability in a large sample with a clustered data structure from an educational context. Whereas girls outperformed boys in languages, boys excelled in sciences and reasoning. Multilevel analyses indicated a small indirect effect of gender on school grades mediated by reasoning ability. Gender differences in sciences, but not in languages were largely explained by reasoning ability, but not by factors such as gender ratio in the classroom or mental speed. The predictive power of reasoning ability for languages, but not sciences was larger in classrooms with higher mean reasoning ability. Further, gender differences in languages, but not sciences varied significantly across classrooms. Reasoning ability appears to be important for predicting scholastic achievement in sciences, whereas languages are more affected by gender-related attributes. (Contains 2 figures and 6 tables.)