In vitro experiments in which tumour cells are seeded in a gelatinous medium, or hydrogel, show how mechanical interactions between tumour cells and the tissue in which they are embedded, together with local levels of an externally-supplied, diffusible nutrient (e.g., oxygen), affect the tumour’s growth dynamics. In this article, we present a mathematical model that describes these in vitro experiments. We use the model to understand how tumour growth generates mechanical deformations in the hydrogel and how these deformations in turn influence the tumour’s growth. The hydrogel is viewed as a nonlinear hyperelastic material and the tumour is modelled as a two-phase mixture, comprising a viscous tumour cell phase and an isotropic, inviscid interstitial fluid phase. Using a combination of numerical and analytical techniques, we show how the tumour’s growth dynamics change as the mechanical properties of the hydrogel vary. When the hydrogel is soft, nutrient availability dominates the dynamics: the tumour evolves to a large equilibrium configuration where the proliferation rate of nutrient-rich cells on the tumour boundary balances the death rate of nutrient-starved cells in the central, necrotic core. As the hydrogel stiffness increases, mechanical resistance to growth increases and the tumour’s equilibrium size decreases. Indeed, for small tumours embedded in stiff hydrogels, the inhibitory force experienced by the tumour cells may be so large that the tumour is eliminated. Analysis of the model identifies parameter regimes in which the presence of the hydrogel drives tumour elimination. © 2022, The Author(s), under exclusive licence to Springer-Verlag GmbH Germany, part of Springer Nature.