Background The effectiveness of SARS-CoV-2 vaccines in older adults living in long-term care facilities is uncertain. We investigated the protective effect of the first dose of the Oxford-AstraZeneca non-replicating viral-vectored vaccine (ChAdOx1 nCoV-19; AZD1222) and the Pfizer-BioNTech mRNA-based vaccine (BNT162b2) in residents of long-term care facilities in terms of PCR-confirmed SARS-CoV-2 infection over time since vaccination. Methods The VIVALDI study is a prospective cohort study that commenced recruitment on June 11, 2020, to investigate SARS-CoV-2 transmission, infection outcomes, and immunity in residents and staff in long-term care facilities in England that provide residential or nursing care for adults aged 65 years and older. In this cohort study, we included long-term care facility residents undergoing routine asymptomatic SARS-CoV-2 testing between Dec 8, 2020 (the date the vaccine was first deployed in a long-term care facility), and March 15, 2021, using national testing data linked within the COVID-19 Datastore. Using Cox proportional hazards regression, we estimated the relative hazard of PCR-positive infection at 0-6 days, 7-13 days, 14-20 days, 21-27 days, 28-34 days, 35-48 days, and 49 days and beyond after vaccination, comparing unvaccinated and vaccinated person-time from the same cohort of residents, adjusting for age, sex, previous infection, local SARS-CoV-2 incidence, long-term care facility bed capacity, and clustering by long-term care facility. We also compared mean PCR cycle threshold (Ct) values for positive swabs obtained before and after vaccination. The study is registered with ISRCTN, number 14447421. Findings 10 412 care home residents aged 65 years and older from 310 LTCFs were included in this analysis. The median participant age was 86 years (IQR 80-91), 7247 (69•6%) of 10 412 residents were female, and 1155 residents (11•1%) had evidence of previous SARS-CoV-2 infection. 9160 (88•0%) residents received at least one vaccine dose, of whom 6138 (67•0%) received ChAdOx1 and 3022 (33•0%) received BNT162b2. Between Dec 8, 2020, and March 15, 2021, there were 36 352 PCR results in 670 628 person-days, and 1335 PCR-positive infections (713 in unvaccinated residents and 612 in vaccinated residents) were included. Adjusted hazard ratios (HRs) for PCR-positive infection relative to unvaccinated residents declined from 28 days after the first vaccine dose to 0•44 (95% CI 0•24-0•81) at 28-34 days and 0•38 (0•19-0•77) at 35-48 days. Similar effect sizes were seen for ChAdOx1 (adjusted HR 0•32, 95% CI 0•15-0•66) and BNT162b2 (0•35, 0•17-0•71) vaccines at 35-48 days. Mean PCR Ct values were higher for infections that occurred at least 28 days after vaccination than for those occurring before vaccination (31•3 [SD 8•7] in 107 PCR-positive tests vs 26•6 [6•6] in 552 PCR-positive tests; p<0•0001).Interpretation Single-dose vaccination with BNT162b2 and ChAdOx1 vaccines provides substantial protection against infection in older adults from 4-7 weeks after vaccination and might reduce SARS...