A multicenter, retrospective cohort study included 386 adult patients hospitalized with severe or critical COVID-19 in three hospitals in Shaanxi Province from December 2022 to November 2023. Patients were divided into nirmatrelvir/ritonavir (n=173) and no antiviral treatment (n=213) groups. The nirmatrelvir/ritonavir group had significantly lower 28-day mortality (6.9% vs. 15.5%; p=0.002) and in-hospital mortality (8.1% vs. 16.0%; p=0.003). After adjustment for variables, nirmatrelvir/ritonavir was independently associated with a reduced risk of 28-day mortality (aHR=0.346, 95% CI: 0.175–0.687; p=0.002) and in-hospital mortality (aHR=0.374, 95% CI: 0.196–0.716; p=0.003). The reduced risk was more pronounced in patients ≥65 years of age, nonsmokers, without chronic lung disease or hypertension, with critical illness, and when treatment was initiated within 5 days of symptoms. The median length of hospital stay after baseline was longer in the treatment group (11.0 vs. 9.0 days; p=0.019). The study supports the use of nirmatrelvir/ritonavir in hospitalized patients with severe or critical COVID-19.