Autism spectrum disorder (ASD) is a highly heritable condition with a large variation in cognitive function. Here we investigated the shared genetic architecture between cognitive traits (intelligence (INT) and educational attainment (EDU)), and risk loci jointly associated with ASD and the cognitive traits. We analyzed data from genome-wide association studies (GWAS) of INT (n = 269,867), EDU (n = 766,345) and ASD (cases n = 18,381, controls n = 27,969). We used the bivariate causal mixture model (MiXeR) to estimate the total number of shared genetic variants, local analysis of co-variant annotation (LAVA) to estimate local genetic correlations, conditional false discovery rate (cond/conjFDR) to identify specific overlapping loci. The MiXeR analyses showed that 12.7k genetic variants are associated with ASD, of which 12.0k variants are shared with EDU, and 11.1k are shared with INT with both positive and negative relationships within overlapping variants. The majority (59–68%) of estimated shared loci have concordant effect directions, with a positive, albeit modest, genetic correlation between ASD and EDU (rg = 0.21, p = 2e−13) and INT (rg = 0.22, p = 4e−12). We discovered 43 loci jointly associated with ASD and cognitive traits (conjFDR<0.05), of which 27 were novel for ASD. Functional analysis revealed significant differential expression of candidate genes in the cerebellum and frontal cortex. To conclude, we quantified the genetic architecture shared between ASD and cognitive traits, demonstrated mixed effect directions, and identified the associated genetic loci and molecular pathways. The findings suggest that common genetic risk factors for ASD can underlie both better and worse cognitive functioning across the ASD spectrum, with different underlying biology.