The mechanics of the cellular microenvironment continuously modulates cell functions such as growth, survival, apoptosis, differentiation and morphogenesis via cytoskeletal remodelling and actomyosin contractility1-3. Although all of these processes consume energy4,5, it is unknown whether and how cells adapt their metabolic activity to variable mechanical cues. Here we report that the transfer of human bronchial epithelial cells from stiff to soft substrates causes a downregulation of glycolysis via proteasomal degradation of the rate-limiting metabolic enzyme phosphofructokinase (PFK). PFK degradation is triggered by the disassembly of stress fibres, which releases the PFK-targeting E3 ubiquitin ligase tripartite motif (TRIM)-containing protein 21 (TRIM21). Transformed non-small-cell lung cancer cells, which maintain high glycolytic rates regardless of changing environmental mechanics, retain PFK expression by downregulating TRIM21, and by sequestering residual TRIM21 on a stress-fibre subset that is insensitive to substrate stiffness. Our data reveal a mechanism by which glycolysis responds to architectural features of the actomyosin cytoskeleton, thus coupling cell metabolism to the mechanical properties of the surrounding tissue. These processes enable normal cells to tune energy production in variable microenvironments, whereas the resistance of the cytoskeleton in response to mechanical cues enables the persistence of high glycolytic rates in cancer cells despite constant alterations of the tumour tissue.