The extracellular matrix (ECM) is a key determinant of cancer progression and prognosis. Here we report findings from one of the largest pan-cancer analyses of ECM gene dysregulation in cancer. We define a distinct set of ECM genes upregulated in cancer (C-ECM) and linked to worse prognosis. We found that the C-ECM transcriptional programme dysregulation is correlated with the activation of TGF-β signalling in cancer-associated fibroblasts and is linked to immunosuppression in otherwise immunologically active tumours. Cancers that activate this programme carry distinct genomic profiles, such as BRAF, SMAD4 and TP53 mutations and MYC amplification. Finally, we show that this signature is a predictor of the failure of PD-1 blockade and outperforms previously-proposed biomarkers. Thus, our findings identify a distinct transcriptional pattern of ECM genes in operation across cancers that may be potentially targeted, pending preclinical validation, using TGF-β blockade to enhance responses to immune-checkpoint blockade.