Potassium ions released by necrotic cells in tumours impair T cell function by increasing the intracellular potassium concentration in vitro and in vivo. Cell death in tumours is frequently associated with a poor prognosis, a phenomenon that has previously been attributed to rapidly dividing cancer cells in a resource-limited environment. Robert Eil et al. demonstrate that intratumoural cell death in fact plays an active part in suppressing anti-tumour immunity. They show that elevated extracellular potassium in human and mouse tumour interstitial fluid inhibits T-cell-receptor-induced anti-tumour functions in human and mouse T cells. In addition, this immune suppression can be reversed by enabling tumour-specific T cells to efflux potassium through overexpression of the exporter Kcna3. Tumours progress despite being infiltrated by tumour-specific effector T cells1. Tumours contain areas of cellular necrosis, which are associated with poor survival in a variety of cancers2. Here, we show that necrosis releases intracellular potassium ions into the extracellular fluid of mouse and human tumours, causing profound suppression of T cell effector function. Elevation of the extracellular potassium concentration ([K+]e) impairs T cell receptor (TCR)-driven Akt–mTOR phosphorylation and effector programmes. Potassium-mediated suppression of Akt–mTOR signalling and T cell function is dependent upon the activity of the serine/threonine phosphatase PP2A3,4. Although the suppressive effect mediated by elevated [K+]e is independent of changes in plasma membrane potential (Vm), it requires an increase in intracellular potassium ([K+]i). Accordingly, augmenting potassium efflux in tumour-specific T cells by overexpressing the potassium channel Kv1.3 lowers [K+]i and improves effector functions in vitro and in vivo and enhances tumour clearance and survival in melanoma-bearing mice. These results uncover an ionic checkpoint that blocks T cell function in tumours and identify potential new strategies for cancer immunotherapy.