Nirmatrelvir-ritonavir is used in patients with coronavirus disease 2019 (COVID-19) with normal or mild renal impairment (eGFR ≥30 ml/min per 1.73 m2). There is limited data regarding its use in advanced kidney disease (eGFR <30 ml/min per 1.73 m2). We performed a retrospective territory-wide observational study evaluating the safety and efficacy of nirmatrelvir-ritonavir when compared with molnupiravir in the treatment of patients with COVID-19 with advanced kidney disease. We adopted target trial emulation using data from a territory-wide electronic health record database on eligible patients aged ≥18 years with advanced kidney disease (history of eGFR <30 ml/min per 1.73 m2) who were infected with COVID-19 and were prescribed with either molnupiravir or nirmatrelvir-ritonavir within five days of infection during the period from 16 March 2022 to 31 December 2022. A sequence trial approach and 1:4 propensity score matching was applied based on the baseline covariates including age, sex, number of COVID-19 vaccine doses received, Charlson comorbidity index (CCI), hospitalisation, eGFR, renal replacement therapy, comorbidities (cancer, respiratory disease, myocardial infarction, ischaemic stroke, diabetes, hypertension), and drug use (renin-angiotensin-system agents, beta blockers, calcium channel blockers, diuretics, nitrates, lipid lowering agents, insulins, oral antidiabetic drugs, antiplatelets, immuno-suppressants, corticosteroids, proton pump inhibitors, histamine H2 receptor antagonists, monoclonal antibody infusion) within past 90 days. Individuals were followed up from the index date until the earliest outcome occurrence, death, 90 days from index date or the end of data availability. Stratified Cox proportional hazards regression adjusted with baseline covariates was used to compare the risk of outcomes between nirmatrelvir-ritonavir recipients and molnupiravir recipients which include (i) all-cause mortality, (ii) intensive care unit (ICU) admission, (iii) ventilatory support, (iv) hospitalisation, (v) hepatic impairment, (vi) ischaemic stroke, and (vii) myocardial infarction. Subgroup analyses included age (<70; ≥70 years); sex, Charlson comorbidity index (≤5; >5), and number of COVID-19 vaccine doses received (0-1; ≥2 doses). A total of 4886 patients were included (nirmatrelvir-ritonavir: 1462; molnupiravir: 3424). There were 347 events of all-cause mortality (nirmatrelvir-ritonavir: 74, 5.06%; molnupiravir: 273, 7.97%), 10 events of ICU admission (nirmatrelvir-ritonavir: 4, 0.27%; molnupiravir: 6, 0.18%), 48 events of ventilatory support (nirmatrelvir-ritonavir: 13, 0.89%; molnupiravir: 35, 1.02%), 836 events of hospitalisation (nirmatrelvir-ritonavir: 218, 23.98%; molnupiravir: 618, 28.14%), 1 event of hepatic impairment (nirmatrelvir-ritonavir: 0, 0%; molnupiravir: 1, 0.03%), 8 events of ischaemic stroke (nirmatrelvir-ritonavir: 3, 0.22%; molnupiravir: 5, 0.16%) and 9 events of myocardial infarction (nirmatrelvir-ritonavir: 2, 0.15%; molnupiravir: 7, 0.22%). Nirmatrelvir-ritonavir users had lower rates of all-cause mortality (absolute risk reduction (ARR) at 90 days 2.91%, 95% CI: 1.47-4.36%) and hospitalisation (ARR at 90 days 4.16%, 95% CI: 0.81-7.51%) as compared with molnupiravir users. Similar rates of ICU admission (ARR at 90 days -0.09%, 95% CI: -0.4 to 0.2%), ventilatory support (ARR at 90 days 0.13%, 95% CI: -0.45 to 0.72%), hepatic impairment (ARR at 90 days 0.03%, 95% CI: -0.03 to 0.09%), ischaemic stroke (ARR at 90 days -0.06%, 95% CI: -0.35 to 0.22%), and myocardial infarction (ARR at 90 days 0.07%, 95% CI: -0.19 to 0.33%) were found between nirmatrelvir-ritonavir and molnupiravir users. Consistent results were observed in relative risk adjusted with baseline characteristics. Nirmatrelvir-ritonavir was associated with significantly reduced risk of all-cause mortality (HR: 0.624, 95% CI: 0.455-0.857) and hospitalisation (HR: 0.782, 95% CI: 0.64-0.954). Patients with COVID-19 with advanced kidney disease receiving nirmatrelvir-ritonavir had a lower rate of all-cause mortality and hospital admission when compared with molnupiravir. Other adverse clinical outcomes were similar in both treatment groups. Health and Medical Research Fund (COVID1903010), Health Bureau, The Government of the Hong Kong Special Administrative Region, China.