Cyclin-dependent kinase 9 (CDK9) is a well-validated target for cancer treatment. In this work, starting from a multitargeted CDK1/2/9 inhibitor ZK304709, optimization efforts successfully led to the discovery of a highly potent selective CDK9 inhibitor 8e which exhibites significant enzyme inhibitory activity (IC50 = 5.5 nM) which is comparable to that of ZK304709 (IC50 = 5.0 nM). More importantly, 8e shows high selectivity for CDK9 versus CDK1, CDK2, CDK4, and CDK6, respectively. Additionally, 8e possesses greater or similar antiproliferative efficacy with ZK304709 against HeLa, A549, HCT116, and MCF-7 cells, and exhibits potent in vivo antitumor activity in HCT116 xenograft mouse models with tumor growth inhibition of 59.2 % at 60 mg/kg without obvious signs of toxicity. Research on the mechanism reveals that 8e could concentration-dependently cause the G2/M phase arrest and induce cell apoptosis in HCT116 cells. These observations provide a novel tetrahydrothiazolopyridine-based pyrimidine scaffold to further develop selective CDK9 inhibitors for cancer therapy.