Single-cell technologies have enabled the characterization of the tumour microenvironment at unprecedented depth and have revealed vast cellular diversity among tumour cells and their niche. Anti-tumour immunity relies on cell-cell relationships within the tumour microenvironment1,2, yet many single-cell studies lack spatial context and rely on dissociated tissues3. Here we applied imaging mass cytometry to characterize the immunological landscape of 139 high-grade glioma and 46 brain metastasis tumours from patients. Single-cell analysis of more than 1.1 million cells across 389 high-dimensional histopathology images enabled the spatial resolution of immune lineages and activation states, revealing differences in immune landscapes between primary tumours and brain metastases from diverse solid cancers. These analyses revealed cellular neighbourhoods associated with survival in patients with glioblastoma, which we leveraged to identify a unique population of myeloperoxidase (MPO)-positive macrophages associated with long-term survival. Our findings provide insight into the biology of primary and metastatic brain tumours, reinforcing the value of integrating spatial resolution to single-cell datasets to dissect the microenvironmental contexture of cancer.