Potato late blight, which is caused by Phytophthora infestans and was responsible for the Irish potato famine, remains a major threat to global food security1. Most late-blight resistance (R) genes encode nucleotide-binding leucine-rich repeat proteins (NLRs), but many have been overcome by the rapid evolution of P. infestans2. Deploying R genes through hybrid potato breeding3-7 offers a promising solution to manage late blight. Here we construct a section-wide NLRome comprising 39,211 NLR genes from 31 wild and 21 cultivated potato genomes, representing Solanum section Petota, the tuber-bearing clade. This includes newly sequenced genomes of seven wild species with strong resistance to late blight. Phylogenomic analyses reveal asymmetric patterns of evolution that distinguish sensor and helper NLRs. Mining of the NLRome enabled us to clone Rpi-cph1, a homologue of which has previously been identified only in American black nightshade, and Rpi-cjm1, a Toll/interleukin-1 receptor (TIR) domain-containing NLR against late blight. We show that non-canonical NLR integrated domains are widespread in the NLRome. Tracing their evolutionary trajectory enabled us to identify Rpi-brk1, an R gene that perceives a P. infestans effector through its heavy-metal-associated (HMA) domain. We find that incorporating the HMA domain into the potato NLR R1 broadens its resistance spectrum, suggesting that a domain 'plug-in' strategy could be used to engineer disease resistance. These findings provide a paradigm for R-gene discovery through comparative and evolutionary genomics, and a strategy for R-gene engineering.