SummaryBackgroundExperimental data show that drug-resistance-conferring mutations are often associated with a decrease in the replicative fitness of bacteria in vitro, and that this fitness cost can be mitigated by compensatory mutations; however, the role of compensatory evolution in clinical settings is less clear. We assessed whether compensatory evolution was associated with increased transmission of rifampicin-resistant tuberculosis in Khayelitsha, Cape Town, South Africa.MethodsWe did a genomic epidemiological study by analysing availableM tuberculosisisolates and their associated clinical data from individuals routinely diagnosed with rifampicin-resistant tuberculosis in primary care and hospitals in Khayelitsha, Cape Town, South Africa. Isolates were collected as part of a previous study. All individuals diagnosed with rifampicin-resistant tuberculosis and with linked biobanked specimens were included in this study. We applied whole-genome sequencing, Bayesian reconstruction of transmission trees, and phylogenetic multivariable regression analysis to identify individual and bacterial factors associated with the transmission of rifampicin-resistantM tuberculosisstrains.FindingsBetween Jan 1, 2008, and Dec 31, 2017, 2161 individuals were diagnosed with multidrug-resistant or rifampicin-resistant tuberculosis in Khayelitsha, Cape Town, South Africa. Whole-genome sequences were available for 1168 (54%) unique individualM tuberculosisisolates. Compensatory evolution was associated with smear-positive pulmonary disease (adjusted odds ratio 1·49, 95% CI 1·08–2·06) and a higher number of drug-resistance-conferring mutations (incidence rate ratio 1·38, 95% CI 1·28–1·48). Compensatory evolution was also associated with increased transmission of rifampicin-resistant disease between individuals (adjusted odds ratio 1·55; 95% CI 1·13–2·12), independent of other patient and bacterial factors.InterpretationOur findings suggest that compensatory evolution enhances the in vivo fitness of drug-resistantM tuberculosisgenotypes, both within and between patients, and that the in vitro replicative fitness of rifampicin-resistantM tuberculosismeasured in the laboratory correlates with the bacterial fitness measured in clinical settings. These results emphasise the importance of enhancing surveillance and monitoring efforts to prevent the emergence of highly transmissible clones capable of rapidly accumulating new drug resistance mutations. This concern becomes especially crucial at present, because treatment regimens incorporating novel drugs are being implemented.FundingFunding for this study was provided by a Swiss and South Africa joint research award (grant numbers 310030_188888, CRSII5_177163, and IZLSZ3_170834), the European Research Council (grant number 883582), and a Wellcome Trust fellowship (to HC; reference number 099818/Z/12/Z). ZS-D was funded through a PhD scholarship from the South African National Research Foundation and RMW was funded through the South African Medical Research Council.