While CRISPR screens are helping uncover genes regulating many cell-intrinsic processes, existing approaches are suboptimal for identifying extracellular gene functions, particularly in the tissue context. Here, we developed an approach for spatial functional genomics called Perturb-map. We applied Perturb-map to knock out dozens of genes in parallel in a mouse model of lung cancer and simultaneously assessed how each knockout influenced tumor growth, histopathology, and immune composition. Moreover, we paired Perturb-map and spatial transcriptomics for unbiased analysis of CRISPR-edited tumors. We found that in Tgfbr2 knockout tumors, the tumor microenvironment (TME) was converted to a fibro-mucinous state, and T cells excluded, concomitant with upregulated TGFβ and TGFβ-mediated fibroblast activation, indicating that TGFβ-receptor loss on cancer cells increased TGFβ bioavailability and its immunosuppressive effects on the TME. These studies establish Perturb-map for functional genomics within the tissue at single-cell resolution with spatial architecture preserved and provide insight into how TGFβ responsiveness of cancer cells can affect the TME.