Studies have established the short-term efficacy of nirmatrelvir-ritonavir in managing COVID-19, yet its effect on post-COVID-19 condition, especially in patients admitted to hospital, remains understudied. This study aimed to examine the effect of nirmatrelvir-ritonavir on post-COVID-19 condition among patients admitted to hospital in Hong Kong. This retrospective cohort study used real-world, territory-wide inpatient records, vaccination records, and confirmed COVID-19 case data from the Hong Kong Hospital Authority and Department of Health, The Government of the Hong Kong Special Administrative Region. Patients aged 18 years and older who tested positive for SARS-CoV-2 between March 11, 2022, and Oct 10, 2023, and who were admitted to hospital with COVID-19 were included. The treatment group included patients prescribed nirmatrelvir-ritonavir within 5 days of symptom onset, excluding those prescribed molnupiravir within 21 days, and the control group had no exposure to either nirmatrelvir-ritonavir or molnupiravir. The outcomes were post-acute inpatient death and 13 sequelae (congestive heart failure, atrial fibrillation, coronary artery disease, deep vein thrombosis, chronic pulmonary disease, acute respiratory distress syndrome, interstitial lung disease, seizure, anxiety, post-traumatic stress disorder, end-stage renal disease, acute kidney injury, and pancreatitis). These outcomes were evaluated starting at 21 days after the positive RT-PCR date in each respective cohort constructed for the outcome. Standardised mortality ratio weights were applied to balance covariates, and Cox proportional hazards regression was used to investigate the relationship between nirmatrelvir-ritonavir and outcomes. 136 973 patients were screened for inclusion, among whom 50 055 were eligible and included in the analysis (24 873 [49·7%] were female and 25 182 [50·3%] were male). 15 242 patients were prescribed nirmatrelvir-ritonavir during acute COVID-19 and 23 756 patients were included in the control group; 11 057 patients did not meet our definition for the exposed and unexposed groups. Patients were followed up for a median of 393 days (IQR 317-489). In the nirmatrelvir-ritonavir group compared with the control group, there was a significantly lower hazard of post-acute inpatient death (hazard ratio 0·62 [95% CI 0·57-0·68]; p<0·0001), congestive heart failure (0·70 [0·58-0·85]; p=0·0002), atrial fibrillation (0·63 [0·52-0·76]; p<0·0001), coronary artery disease (0·71 [0·59-0·85]; p=0·0002), chronic pulmonary disease (0·68 [0·54-0·86]; p=0·0011), acute respiratory distress syndrome (0·71 [0·58-0·86]; p=0·0007), interstitial lung disease (0·17 [0·04-0·75]; p=0·020), and end-stage renal disease (0·37 [0·18-0·74]; p=0·0049). There was no evidence indicating difference between the groups in deep vein thrombosis, seizure, anxiety, post-traumatic stress disorder, acute kidney injury, and pancreatitis. This study showed extended benefits of nirmatrelvir-ritonavir for reducing the risk of post-acute inpatient death as well as cardiovascular and respiratory complications among patients admitted to hospital with COVID-19. Further research is essential to uncover the underlying mechanisms responsible for these observed negative associations and to devise effective strategies for preventing the onset of post-acute sequelae. Health and Medical Research Fund, Research Grants Council theme-based research schemes, and Research Grants Council Collaborative Research Fund.