Spatial transcriptomics analyses can be affected by noise and spatial correlation across tissue locations. Here, the authors develop SpatialPCA, a spatially-aware dimensionality reduction method that explicitly models spatial correlation structures, and show its application to the analysis of healthy and tumour tissues.