A variety of species of bacteria are known to colonize human tumours1–11, proliferate within them and modulate immune function, which ultimately affects the survival of patients with cancer and their responses to treatment12–14. However, it is not known whether antigens derived from intracellular bacteria are presented by the human leukocyte antigen class I and II (HLA-I and HLA-II, respectively) molecules of tumour cells, or whether such antigens elicit a tumour-infiltrating T cell immune response. Here we used 16S rRNA gene sequencing and HLA peptidomics to identify a peptide repertoire derived from intracellular bacteria that was presented on HLA-I and HLA-II molecules in melanoma tumours. Our analysis of 17 melanoma metastases (derived from 9 patients) revealed 248 and 35 unique HLA-I and HLA-II peptides, respectively, that were derived from 41 species of bacteria. We identified recurrent bacterial peptides in tumours from different patients, as well as in different tumours from the same patient. Our study reveals that peptides derived from intracellular bacteria can be presented by tumour cells and elicit immune reactivity, and thus provides insight into a mechanism by which bacteria influence activation of the immune system and responses to therapy.