Predictive biomarkers could allow more precise use of immune checkpoint inhibitors (ICIs) in treating advanced cancers. Given the central role of HLA molecules in immunity, variation at the HLA loci could differentially affect the response to ICIs. The aim of this epidemiological study was to determine the effect of HLA-A*03 as a biomarker for predicting response to immunotherapy. In this epidemiological study, we investigated the clinical outcomes (overall survival, progression free survival, and objective response rate) after treatment for advanced cancer in eight cohorts of patients: three observational cohorts of patients with various types of advanced tumours (the Memorial Sloan Kettering Integrated Mutation Profiling of Actionable Cancer Targets [MSK-IMPACT] cohort, the Dana-Farber Cancer Institute [DFCI] Profile cohort, and The Cancer Genome Atlas) and five clinical trials of patients with advanced bladder cancer (JAVELIN Solid Tumour) or renal cell carcinoma (CheckMate-009, CheckMate-010, CheckMate-025, and JAVELIN Renal 101). In total, these cohorts included 3335 patients treated with various ICI agents (anti-PD-1, anti-PD-L1, and anti-CTLA-4 inhibitors) and 10 917 patients treated with non-ICI cancer-directed therapeutic approaches. We initially modelled the association of HLA amino-acid variation with overall survival in the MSK-IMPACT discovery cohort, followed by a detailed analysis of the association between HLA-A*03 and clinical outcomes in MSK-IMPACT, with replication in the additional cohorts (two further observational cohorts and five clinical trials). HLA-A*03 was associated in an additive manner with reduced overall survival after ICI treatment in the MSK-IMPACT cohort (HR 1·48 per HLA-A*03 allele [95% CI 1·20-1·82], p=0·00022), the validation DFCI Profile cohort (HR 1·22 per HLA-A*03 allele, 1·05-1·42; p=0·0097), and in the JAVELIN Solid Tumour clinical trial for bladder cancer (HR 1·36 per HLA-A*03 allele, 1·01-1·85; p=0·047). The HLA-A*03 effect was observed across ICI agents and tumour types, but not in patients treated with alternative therapies. Patients with HLA-A*03 had shorter progression-free survival in the pooled patient population from the three CheckMate clinical trials of nivolumab for renal cell carcinoma (HR 1·31, 1·01-1·71; p=0·044), but not in those receiving control (everolimus) therapies. Objective responses were observed in none of eight HLA-A*03 homozygotes in the ICI group (compared with 59 [26·6%] of 222 HLA-A*03 non-carriers and 13 (17·1%) of 76 HLA-A*03 heterozygotes). HLA-A*03 was associated with shorter progression-free survival in patients receiving ICI in the JAVELIN Renal 101 randomised clinical trial for renal cell carcinoma (avelumab plus axitinib; HR 1·59 per HLA-A*03 allele, 1·16-2·16; p=0·0036), but not in those receiving control (sunitinib) therapy. Objective responses were recorded in one (12·5%) of eight HLA-A*03 homozygotes in the ICI group (compared with 162 [63·8%] of 254 HLA-A*03 non-carriers and 40 [55·6%] of 72 HLA-A*03 heterozygotes). HLA-A*03 was associated with impaired outcome in meta-analysis of all 3335 patients treated with ICI at genome-wide significance (p=2·01 × 10-8) with no evidence of heterogeneity in effect (I2 0%, 95% CI 0-0·76) INTERPRETATION: HLA-A*03 is a predictive biomarker of poor response to ICI. Further evaluation of HLA-A*03 is warranted in randomised trials. HLA-A*03 carriage could be considered in decisions to initiate ICI in patients with cancer. National Institutes of Health, Merck KGaA, and Pfizer.