To compare the epidemiological characteristics and transmission dynamics in relation to interventions against the COVID-19 and severe acute respiratory syndrome (SARS) outbreak in mainland China. Comparative study based on a unique data set of COVID-19 and SARS. Outbreak in mainland China. The final database included 82 858 confirmed cases of COVID-19 and 5327 cases of SARS. We brought together all existing data sources and integrated them into a comprehensive data set. Individual information on age, sex, occupation, residence location, date of illness onset, date of diagnosis and clinical outcome was extracted. Control measures deployed in mainland China were collected. We compared the epidemiological and spatial characteristics of COVID-19 and SARS. We estimated the effective reproduction number to explore differences in transmission dynamics and intervention effects. Compared with SARS, COVID-19 affected more extensive areas (1668 vs 230 counties) within a shorter time (101 vs 193 days) and had higher attack rate (61.8 vs 4.0 per million persons). The COVID-19 outbreak had only one epidemic peak and one epicentre (Hubei Province), while the SARS outbreak resulted in two peaks and two epicentres (Guangdong Province and Beijing). SARS-CoV-2 was more likely to infect older people (median age of 52 years), while SARS-CoV tended to infect young adults (median age of 34 years). The case fatality rate (CFR) of either disease increased with age, but the CFR of COVID-19 was significantly lower than that of SARS (5.6% vs 6.4%). The trajectory of effective reproduction number dynamically changed in relation to interventions, which fell below 1 within 2 months for COVID-19 and within 5.5 months for SARS. China has taken more prompt and effective responses to combat COVID-19 by learning lessons from SARS, providing us with some epidemiological clues to control the ongoing COVID-19 pandemic worldwide. © Author(s) (or their employer(s)) 2020. Re-use permitted under CC BY-NC. No commercial re-use. See rights and permissions. Published by BMJ.