Tumour-associated antigens (TAAs) comprise a large set of non-mutated cellular antigens recognized by T cells in human and murine cancers. Their potential as targets for immunotherapy has been explored for more than two decades1, yet the origins of TAA-specific T cells remain unclear. While tumour cells may be an important source of TAAs for T cell priming2, several recent studies suggest that infection with some viruses, including Epstein-Barr virus and influenza virus can elicit T cell responses against abnormally expressed cellular antigens that function as TAAs3,4. However, the cellular and molecular basis of such responses remains undefined. Here we show that expression of the Epstein-Barr virus signalling protein LMP1 in B cells provokes T cell responses to multiple TAAs. LMP1 signalling leads to overexpression of many cellular antigens previously shown to be TAAs, their presentation on major histocompatibility complex classes I (MHC-I) and II (MHC-II) (mainly through the endogenous pathway) and the upregulation of costimulatory ligands CD70 and OX40L, thereby inducing potent cytotoxic CD4+ and CD8+ T cell responses. These findings delineate a mechanism of infection-induced anti-tumour immunity. Furthermore, by ectopically expressing LMP1 in tumour B cells from patients with cancer and thereby enabling them to prime T cells, we develop a general approach for rapid production of autologous cytotoxic CD4+ T cells against a wide range of endogenous tumour antigens, such as TAAs and neoantigens, for treating B cell malignancies. This work stresses the need to revisit classical concepts concerning viral and tumour immunity, which will be critical to fully understand the impact of common infections on human health and to improve the rational design of immune approaches to treatment of cancers.