KRAS is widely mutated in human cancers, resulting in nearly unchecked tumour proliferation and metastasis. No therapies have been developed for targeting KRAS-mutant tumours. Herein, we observed that KRAS-mutant stomach/colorectal tumour cells were hypersensitive to the MEK1/2 kinase inhibitor trametinib, which elicits strong apoptotic responses. Genome-wide screening revealed that TP53 is critical for executing trametinib-induced apoptosis of KRAS-mutant tumours, as validated by TP53 knockout and rescue experiments. Mechanistically, p53 physically associates with phosphorylated ERK2 in the presence of mutant KRAS, which inactivates p53 by preventing the recruitment of p300/CBP. Trametinib disrupts the p53-ERK2 complex by inhibiting ERK2 phosphorylation, allowing the recruitment of p300/CBP to acetylate p53 protein; acetylated p53 activates PUMA transcription and thereby promotes the apoptosis of KRAS-mutant tumours. Our study unveils an important role of the ERK2-p53 axis and provides a potential therapeutic strategy for treating KRAS-mutant cancer via ERK2 inhibition.