The clinical success of the ABL tyrosine kinase inhibitor imatinib in chronic myeloid leukaemia (CML) serves as a model for molecularly targeted therapy of cancer, but at least two critical questions remain. Can imatinib eradicate leukaemic stem cells? What are the dynamics of relapse due to imatinib resistance, which is caused by mutations in the ABL kinase domain? The precise understanding of how imatinib exerts its therapeutic effect in CML and the ability to measure disease burden by quantitative polymerase chain reaction provide an opportunity to develop a mathematical approach. We find that a four-compartment model, based on the known biology of haematopoietic differentiation, can explain the kinetics of the molecular response to imatinib in a 169-patient data set. Successful therapy leads to a biphasic exponential decline of leukaemic cells. The first slope of 0.05 per day represents the turnover rate of differentiated leukaemic cells, while the second slope of 0.008 per day represents the turnover rate of leukaemic progenitors. The model suggests that imatinib is a potent inhibitor of the production of differentiated leukaemic cells, but does not deplete leukaemic stem cells. We calculate the probability of developing imatinib resistance mutations and estimate the time until detection of resistance. Our model provides the first quantitative insights into the in vivo kinetics of a human cancer.