We present here a space- and phenotype-structured model of selection dynamics between cancer cells within a solid tumour. In the framework of this model, we combine formal analyses with numerical simulations to investigate in silico the role played by the spatial distribution of abiotic components of the tumour microenvironment in mediating phenotypic selection of cancer cells. Numerical simulations are performed both on the 3D geometry of an in silico multicellular tumour spheroid and on the 3D geometry of an in vivo human hepatic tumour, which was imaged using computerised tomography. The results obtained show that inhomogeneities in the spatial distribution of oxygen, currently observed in solid tumours, can promote the creation of distinct local niches and lead to the selection of different phenotypic variants within the same tumour. This process fosters the emergence of stable phenotypic heterogeneity and supports the presence of hypoxic cells resistant to cytotoxic therapy prior to treatment. Our theoretical results demonstrate the importance of integrating spatial data with ecological principles when evaluating the therapeutic response of solid tumours to cytotoxic therapy.