The drivers of immune evasion are not entirely clear, limiting the success of cancer immunotherapies. Here we applied single-cell spatial and perturbational transcriptomics to delineate immune evasion in high-grade serous tubo-ovarian cancer. To this end, we first mapped the spatial organization of high-grade serous tubo-ovarian cancer by profiling more than 2.5 million cells in situ in 130 tumors from 94 patients. This revealed a malignant cell state that reflects tumor genetics and is predictive of T cell and natural killer cell infiltration levels and response to immune checkpoint blockade. We then performed Perturb-seq screens and identified genetic perturbations—including knockout of PTPN1 and ACTR8—that trigger this malignant cell state. Finally, we show that these perturbations, as well as a PTPN1/PTPN2 inhibitor, sensitize ovarian cancer cells to T cell and natural killer cell cytotoxicity, as predicted. This study thus identifies ways to study and target immune evasion by linking genetic variation, cell-state regulators and spatial biology. Here the authors provide a resource for ovarian cancer combining spatial transcriptomics, genomics, CRISPR Perturb-seq screens and in silico methods to focus on T cells and natural killer cells in the tumor and their role in immune evasion.