BACKGROUND Infection with severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) provides natural immunity against reinfection. Recent studies have shown waning of the immunity provided by the BNT162b2 vaccine. The time course of natural and hybrid immunity is unknown. METHODS Using the Israeli Ministry of Health database, we extracted data for August and September 2021, when the B.1.617.2 (delta) variant was predominant, on all persons who had been previously infected with SARS-CoV-2 or who had received coronavirus 2019 vaccine. We used Poisson regression with adjustment for confounding factors to compare the rates of infection as a function of time since the last immunity-conferring event. RESULTS The number of cases of SARS-CoV-2 infection per 100,000 person-days at risk (adjusted rate) increased with the time that had elapsed since vaccination with BNT162b2 or since previous infection. Among unvaccinated persons who had recovered from infection, this rate increased from 10.5 among those who had been infected 4 to less than 6 months previously to 30.2 among those who had been infected 1 year or more previously. Among persons who had received a single dose of vaccine after previous infection, the adjusted rate was low (3.7) among those who had been vaccinated less than 2 months previously but increased to 11.6 among those who had been vaccinated at least 6 months previously. Among previously uninfected persons who had received two doses of vaccine, the adjusted rate increased from 21.1 among those who had been vaccinated less than 2 months previously to 88.9 among those who had been vaccinated at least 6 months previously. CONCLUSIONS Among persons who had been previously infected with SARS-CoV-2 (regardless of whether they had received any dose of vaccine or whether they had received one dose before or after infection), protection against reinfection decreased as the time increased since the last immunity-conferring event; however, this protection was higher than that conferred after the same time had elapsed since receipt of a second dose of vaccine among previously uninfected persons. A single dose of vaccine after infection reinforced protection against reinfection.