Activating mutations within the epidermal growth factor receptor (EGFR) kinase domain, commonly L858R or deletions within exon 19, increase EGFR-driven cell proliferation and survival and are correlated with impressive responses to the EGFR inhibitors erlotinib and gefitinib in nonsmall cell lung cancer patients. Approximately 60% of acquired resistance to these agents is driven by a single secondary mutation within the EGFR kinase domain, specifically substitution of the gatekeeper residue threonine-790 with methionine (T790M). Due to dose-limiting toxicities associated with inhibition of wild-type EGFR (wtEGFR), we sought inhibitors of T790M-containing EGFR mutants with selectivity over wtEGFR. Here in this paper, we describe the evolution of HTS hits derived from Jak2/Tyk2 inhibitors into selective EGFR inhibitors. X-ray crystal structures revealed two distinct binding modes and enabled the design of a selective series of novel diaminopyrimidine-based inhibitors with good potency against T790M-containing mutants of EGFR, high selectivity over wtEGFR, broad kinase selectivity, and desirable physicochemical properties.