We examined the effectiveness of maternal vaccination against SARS-CoV-2 infection in 30,288 infants born at Kaiser Permanente Northern California from December 15, 2020, to May 31, 2022. Using Cox regression, the effectiveness of maternal vaccination was 85% (95% confidence interval [CI]: 67, 93), 64% (CI: 43, 78) and 57% (CI: 36,71) during the first 2, 4 and 6 months of life, respectively, in the Delta variant period. In the Omicron variant period, the effectiveness of maternal vaccination in these three age intervals was 22% (CI: -18,48), 14% (CI: -10,32) and 12% (CI: -4,26), respectively. Over the entire study period, the incidence of hospitalization for COVID-19 was lower during the first 6 months of life among infants of vaccinated mothers compared with infants of unvaccinated mothers (21/100,000 person-years vs. 100/100,000 person-years). Maternal vaccination was protective, but protection was lower during Omicron than during Delta. Protection during both periods decreased as infants aged.