General cognitive ability ("g") does not explain sex differences in academic test performance by the end of compulsory education. Instead, individual differences in specific reasoning abilities, after removing the effects of "g," may contribute to the observed gender gaps. Associations between general or specific cognitive abilities, sex, and educational attainments were analysed in a cross-sectional study of 11-year-olds (M = 133.5 months, SD = 3.5), at an age before substantive gender-related selection-bias occurred. The 178,599 pupils (89,545 girls and 89,054 boys) attending English state schools represented 93% of the UK's local education authorities. In 2004 each student completed the Cognitive Abilities Test-Third Edition (CAT3), assessing verbal, quantitative, and nonverbal reasoning abilities. These data were linked to each child's attainment scores on national Key Stage 2 tests in English, mathematics and science. A sex difference in "g," favoring girls, was statistically significant but of negligible effect size (Cohen's d = 0.01). Girls scored 26% of a "SD" higher than boys on a verbal residual factor, and boys scored 28% of a "SD" higher than girls on a quantitative residual factor, with negligible sex differences on a nonverbal residual factor (1% of a SD). In education, 10% more girls than boys achieved UK government targets in English. In mathematics and science, sex differences were less apparent at the government target grade (Level 4), although a 5% greater proportion of boys than girls performed at the highest level in mathematics (Level 5). General cognitive ability ("g") was strongly related to an educational factor score (r = 0.83) as expected, and did not explain sex differences in academic performance. In general linear models, a verbal residual factor explained up to 29% of girls' higher English attainment, and better quantitative skills among boys explained 50% of their higher attainment in mathematics. Besides the significant contributions of specific cognitive abilities to gender differences in English and mathematics, there remains substantive variance of the educational gender gap left to explain. (Contains 5 tables and 1 figure.)