An emerging approach for treating cancer involves programming patient-derived T cells with genes encoding disease-specific chimeric antigen receptors (CARs), so that they can combat tumour cells once they are reinfused. Although trials of this therapy have produced impressive results, the in vitro methods they require to generate large numbers of tumour-specific T cells are too elaborate for widespread application to treat cancer patients. Here, we describe a method to quickly program circulating T cells with tumour-recognizing capabilities, thus avoiding these complications. Specifically, we demonstrate that DNA-carrying nanoparticles can efficiently introduce leukaemia-targeting CAR genes into T-cell nuclei, thereby bringing about long-term disease remission. These polymer nanoparticles are easy to manufacture in a stable form, which simplifies storage and reduces cost. Our technology may therefore provide a practical, broadly applicable treatment that can generate anti-tumour immunity 'on demand' for oncologists in a variety of settings.