Importance: Post-COVID-19 condition (PCC), also known as long COVID, affects many individuals. Prevention of PCC is an urgent public health priority. Objective: To examine whether treatment with nirmatrelvir in the acute phase of COVID-19 is associated with reduced risk of PCC. Design, Setting, and Participants: This cohort study used the health care databases of the US Department of Veterans Affairs (VA) to identify patients who had a SARS-CoV-2 positive test result between January 3, 2022, and December 31, 2022, who were not hospitalized on the day of the positive test result, who had at least 1 risk factor for progression to severe COVID-19 illness, and who had survived the first 30 days after SARS-CoV-2 diagnosis. Those who were treated with oral nirmatrelvir within 5 days after the positive test (n = 35717) and those who received no COVID-19 antiviral or antibody treatment during the acute phase of SARS-CoV-2 infection (control group, n = 246076) were identified. Exposures: Treatment with nirmatrelvir or receipt of no COVID-19 antiviral or antibody treatment based on prescription records. Main Outcomes and Measures: Inverse probability weighted survival models were used to estimate the association of nirmatrelvir (vs control) with post-acute death, post-acute hospitalization, and a prespecified panel of 13 post-acute COVID-19 sequelae (components of PCC) and reported in relative scale as relative risk (RR) or hazard ratio (HR) and in absolute scale as absolute risk reduction in percentage at 180 days (ARR). Results: A total of 281793 patients (mean [SD] age, 61.99 [14.96]; 242383 [86.01%] male) who had a positive SARS-CoV-2 test result and had at least 1 risk factor for progression to severe COVID-19 illness were studied. Among them, 246076 received no COVID-19 antiviral or antibody treatment during the acute phase of SARS-CoV-2 infection, and 35717 received oral nirmatrelvir within 5 days after the positive SARS-CoV-2 test result. Compared with the control group, nirmatrelvir was associated with reduced risk of PCC (RR, 0.74; 95% CI, 0.72-0.77; ARR, 4.51%; 95% CI, 4.01-4.99), including reduced risk of 10 of 13 post-acute sequelae (components of PCC) in the cardiovascular system (dysrhythmia and ischemic heart disease), coagulation and hematologic disorders (pulmonary embolism and deep vein thrombosis), fatigue and malaise, acute kidney disease, muscle pain, neurologic system (neurocognitive impairment and dysautonomia), and shortness of breath. Nirmatrelvir was also associated with reduced risk of post-acute death (HR, 0.53; 95% CI, 0.46-0.61); ARR, 0.65%; 95% CI, 0.54-0.77), and post-acute hospitalization (HR, 0.76; 95% CI, 0.73-0.80; ARR, 1.72%; 95% CI, 1.42-2.01). Nirmatrelvir was associated with reduced risk of PCC in people who were unvaccinated, vaccinated, and boosted, and in people with primary SARS-CoV-2 infection and reinfection. Conclusions and Relevance: This cohort study found that in people with SARS-CoV-2 infection who had at least 1 risk factor for progression to severe disease, treatment with nirmatrelvir within 5 days of a positive SARS-CoV-2 test result was associated with reduced risk of PCC across the risk spectrum in this cohort and regardless of vaccination status and history of prior infection; the totality of findings suggests that treatment with nirmatrelvir during the acute phase of COVID-19 may reduce the risk of post-acute adverse health outcomes.