KRAS is the most frequently mutated oncogene in cancer and encodes a key signalling protein in tumours1,2. The KRAS(G12C) mutant has a cysteine residue that has been exploited to design covalent inhibitors that have promising preclinical activity3–5. Here we optimized a series of inhibitors, using novel binding interactions to markedly enhance their potency and selectivity. Our efforts have led to the discovery of AMG 510, which is, to our knowledge, the first KRAS(G12C) inhibitor in clinical development. In preclinical analyses, treatment with AMG 510 led to the regression of KRASG12C tumours and improved the anti-tumour efficacy of chemotherapy and targeted agents. In immune-competent mice, treatment with AMG 510 resulted in a pro-inflammatory tumour microenvironment and produced durable cures alone as well as in combination with immune-checkpoint inhibitors. Cured mice rejected the growth of isogenic KRASG12D tumours, which suggests adaptive immunity against shared antigens. Furthermore, in clinical trials, AMG 510 demonstrated anti-tumour activity in the first dosing cohorts and represents a potentially transformative therapy for patients for whom effective treatments are lacking.