Approximately 30% of older adults exhibit the neuropathological features of Alzheimer's disease without signs of cognitive impairment. Yet, little is known about the genetic factors that allow these potentially resilient individuals to remain cognitively unimpaired in the face of substantial neuropathology. We performed a large, genome-wide association study (GWAS) of two previously validated metrics of cognitive resilience quantified using a latent variable modelling approach and representing better-than-predicted cognitive performance for a given level of neuropathology. Data were harmonized across 5108 participants from a clinical trial of Alzheimer's disease and three longitudinal cohort studies of cognitive ageing. All analyses were run across all participants and repeated restricting the sample to individuals with unimpaired cognition to identify variants at the earliest stages of disease. As expected, all resilience metrics were genetically correlated with cognitive performance and education attainment traits (P-values < 2.5 × 10-20), and we observed novel correlations with neuropsychiatric conditions (P-values < 7.9 × 10-4). Notably, neither resilience metric was genetically correlated with clinical Alzheimer's disease (P-values > 0.42) nor associated with APOE (P-values > 0.13). In single variant analyses, we observed a genome-wide significant locus among participants with unimpaired cognition on chromosome 18 upstream of ATP8B1 (index single nucleotide polymorphism rs2571244, minor allele frequency = 0.08, P = 2.3 × 10-8). The top variant at this locus (rs2571244) was significantly associated with methylation in prefrontal cortex tissue at multiple CpG sites, including one just upstream of ATPB81 (cg19596477; P = 2 × 10-13). Overall, this comprehensive genetic analysis of resilience implicates a putative role of vascular risk, metabolism, and mental health in protection from the cognitive consequences of neuropathology, while also providing evidence for a novel resilience gene along the bile acid metabolism pathway. Furthermore, the genetic architecture of resilience appears to be distinct from that of clinical Alzheimer's disease, suggesting that a shift in focus to molecular contributors to resilience may identify novel pathways for therapeutic targets.