Public health interventions to control the current epidemic of carbapenem-resistant Klebsiella pneumoniae rely on a comprehensive understanding of its emergence and spread over a wide range of geographical scales. We analysed the genome sequences and epidemiological data of >1,700 K. pneumoniae samples isolated from patients in 244 hospitals in 32 countries during the European Survey of Carbapenemase-Producing Enterobacteriaceae. We demonstrate that carbapenemase acquisition is the main cause of carbapenem resistance and that it occurred across diverse phylogenetic backgrounds. However, 477 of 682 (69.9%) carbapenemase-positive isolates are concentrated in four clonal lineages, sequence types 11, 15, 101, 258/512 and their derivatives. Combined analysis of the genetic and geographic distances between isolates with different β-lactam resistance determinants suggests that the propensity of K. pneumoniae to spread in hospital environments correlates with the degree of resistance and that carbapenemase-positive isolates have the highest transmissibility. Indeed, we found that over half of the hospitals that contributed carbapenemase-positive isolates probably experienced within-hospital transmission, and interhospital spread is far more frequent within, rather than between, countries. Finally, we propose a value of 21 for the number of single nucleotide polymorphisms that optimizes the discrimination of hospital clusters and detail the international spread of the successful epidemic lineage, ST258/512.