SACRAMENTO, Calif. — California Gov. Gavin Newsom survived a historic recall election Tuesday, winning a major vote of confidence during a COVID-19 pandemic that has shattered families and livelihoods and tested his ability to lead the state through the largest worldwide health crisis in modern times.

The recall offered Republicans their best chance in more than a decade to take the helm of the largest state in the union. But the effort was undercut when Newsom and the nation’s leading Democrats, aided by visits to California by President Joe Biden and Vice President Kamala Harris, portrayed the campaign to oust the governor as a “life and death” battle against “Trumpism” and far-right anti-vaccine activists.

Conservative talk show host Larry Elder led the 46 candidates on the second question on the ballot hoping to become governor, but that became meaningless after a majority of Californians voted to keep Newsom in office.

Moments after national television networks called the election for Newsom, the governor walked into the California Democratic Headquarters in Sacramento to talk with reporters, forgoing a victory celebration as is commonplace in traditional campaigns.

Appearing resolute, Newsom cast the rejection of the recall as a vote in support “of all those things we hold dear as Californians.” His victory, he said, was a victory for science-based COVID vaccines to end the pandemic and abortion rights for women, as well as economic and racial justice.

“I’m humbled and grateful to the millions and millions of Californians that exercised their fundamental right to vote and express themselves so overwhelmingly by rejecting the division, by rejecting the cynicism, rejecting so much of the negativity that’s defined our politics in this country over the course of so many years,” Newsom said.

Newsom spent part of election day at an anti-recall rally in a San Francisco union hall, and warned supporters about the consequences to California’s economy and the public health of its nearly 40 million residents if he was recalled and replaced with Elder, who has vowed to repeal the state’s mask and vaccination mandates.

“California has outperformed Florida, Texas, Indiana, the United States as a whole in not only health outcomes, but economic outcomes,” Newsom told reporters. “Our economy contracted at a more modest rate than those states.”

Newsom also criticized both Elder and former President Donald Trump for saying Tuesday’s election was rigged, calling those unfounded allegations a threat to democracy and continuation of the “big lie” that the 2020 presidential election was stolen from Trump.

“This election fraud stuff is a crock; it’s shameful. And when I say that, I mean that,” he said.

The mood inside Elder’s official election night party at the Costa Mesa Hilton remained defiant, even after nearly every major news outlet had declared the recall effort dead Tuesday night.

“Some TV stations are saying it’s coming to an end. It’s way too early,” former Lt. Gov Abel Maldonado said from the lectern to raucous cheers, as partygoers sipped drinks and waved American flags.

But even as speakers maintained that the race could still turn around, scattered partygoers looked increasingly glum as they stared down at their phones.

“The numbers are pretty clear at this point,” said Will Donahue, the 21-year-old chairman of California College Republicans, adding that his organization plans to “build on the recall’s momentum” and defeat Newsom when he runs for reelection in 2022.

For Newsom, the electoral triumph capped an extraordinary eight-week fight for his political survival that came less than three years after he won the governor’s office by the largest margin in modern history.

Newsom’s campaign to defeat the recall effort began on an upbeat note, with the governor touting that California was “roaring back” thanks to lower COVID-19 infection rates in the state and efforts to ensure residents got vaccinated. The state’s restrictions and shutdowns were lifted. Baseball stadiums overflowed with fans starting in June, people were dining inside restaurants and, Newsom promised, public schools would be open for the new academic year.

Newsom and his political allies had prevented any prominent Democrats from jumping into the field of replacement candidates, eliminating a credible alternative for left-leaning Californians who may have soured on the governor.

But in late July, just after the recall election was officially certified for the ballot, cause for concern surfaced for Newsom: A poll showed that likely voters in California were almost evenly split over whether to toss the governor out of office, a dire sign in a state where Democratic voters outnumber Republicans almost 2-to-1.

Political scientist Mindy Romero, director of the University of Southern California’s Center for Inclusive Democracy, said the lingering aftereffects of Newsom’s COVID-19 policies probably made some voters who supported him in the 2018 election indifferent this time around.

She said they held Newsom “at least partially responsible” for the government-mandated restrictions that devastated businesses and forced schoolchildren to stay home in distance-learning programs. Under Newsom’s watch, the state also paid out billions of dollars in fraudulent unemployment benefits while at the same time millions of out-of-work Californians with legitimate claims faced frustrating, lengthy delays in receiving their payments.

Romero said Newsom’s most costly mistake came in November when recall supporters were struggling to gather enough petition signatures to qualify for the ballot. Newsom attended a lobbyist’s birthday party at the upscale French Laundry restaurant in the Napa Valley after he had pleaded with Californians to stay home and avoid multifamily gatherings.

Recall proponents seized on that, criticizing Newsom as an out-of-touch elitist and hypocrite who thought he was above the rules he imposed on other Californians. Romero said that message was “simple and intuitive for people to understand.” It appealed to voters across the political spectrum and lingers still, she said.

“This never should have gotten close,” Romero said. “This whole process has damaged the governor.”

Dave Gilliard, one of the Republican strategists leading the effort to oust the governor, said Newsom was in serious trouble up until August. That changed once Elder emerged as the leading contender to replace Newsom as governor.

“He was in bad shape,” Gilliard said. “Once the focus moved away from Newsom and to his opponent, Elder in this case, his numbers improved greatly. He was able to get Democrats interested again in the election.”

Elder was a perfect foil, Gilliard said. The Republican opposed abortion rights and supported offshore oil drilling, anathema to the state’s Democratic majority. Elder has also been a die-hard supporter of Trump, an immensely unpopular figure in California. In fact, Gilliard said, recall proponents pleaded with Trump’s advisers to “convince him to stay out of it,” which was successful until recent days when he started making baseless claims that California’s recall election was “rigged.”

Most consequential, Gilliard said, was Elder’s vow to repeal the Newsom administration’s mandates requiring students to wear masks in public schools and teachers, state employees and health care workers to be vaccinated. This at a time when the delta variant was raging and most Californians supported Newsom’s actions to stem the spread of the coronavirus.

“Elder allowed Newsom to bring Trump back into it, at least Trumpism, when it came to masks and vaccines,” Gilliard said. “When you combine that with the delta variant, and that people were all of the sudden extremely concerned again about COVID, the timing for Newsom could have not been better.”

At stake was the most powerful elected office in a state of nearly 40 million people, one beset by homelessness, a dire shortage of affordable housing, increases in violent crime and with thousands of businesses that closed or still struggle after statewide shutdowns during the height of the pandemic.

Newsom is the second California governor to have faced a recall election, which was projected to cost $276 million dollars, a price tag blasted by Democrats. In 2003, California voters upset over rolling power outages, budget cuts and a steep increase in vehicle license fees recalled Democratic Gov. Gray Davis from office and elected actor Arnold Schwarzenegger, who remains the last Republican to have served as the state’s chief executive.

The spectacle of the 2003 recall election entranced the nation with its only-in-California cast of political candidates, which, along with Schwarzenegger, included Hustler magazine founder Larry Flynt, Huffington Post co-founder Arianna Huffington and “Diff’rent Strokes” star Gary Coleman.

By comparison, the 2021 sequel fell flat.

Reality television star and former Olympic decathlete Caitlyn Jenner tried to capture some of the Schwarzenegger magic but did not win over California voters despite her visibility in cable television news coverage.

A small crowd of Jenner’s supporters and campaign advisers assembled Tuesday night at the Stonehaus, an upscale restaurant and wine bar in Westlake Village, ahead of her arrival. Jenner, the most prominent transgender candidate in American political history, had yet to arrive when the polls closed.

Among them was Rev. Grace Wilgefortis Ferris, who had invited Jenner to guest speak on her podcast, “Just as I am.” A Catholic Apostolic Church deacon and founder of the Saint Wilgefortis TransMISSION church, Ferris said her bishop warned her that Jenner was very conservative. But Ferris said “I’m just interested in people as people.”

“She’s such an inspiration for the community,” Ferris said.

Trying to, as he put it, make his campaign more “beastly,” Republican John Cox at one point enlisted help from a 1,000-pound Kodiak bear named Tag to drum up interest in his campaign. Neither the bear nor the $7.6 million he poured into the race helped replicate the success he had in 2018, when he won enough voter support in the gubernatorial primary to face Newsom in the general election — only to be trounced.

On Tuesday morning, Cox acknowledged that Elder had “shaken up the race quite a bit.” With a double-digit lead over any other candidate, Elder far outpaced Cox, who was backed by 4% of likely voters leading up to the election, according to the latest University of California, Berkeley Institute of Governmental Studies poll co-sponsored by the Los Angeles Times.

Cox said he hoped the polls were wrong, and repeated his stance that undecided voters would decide the election.

“The important thing is that we vote yes on the recall ... doesn’t matter if people select Larry or myself,” Cox said.

Kevin Paffrath, who boasts 1.7 million followers on his YouTube channel, had the highest profile of the little-known Democrats on the ballot, even managing to make it to the stage during one of the candidate debates. Paffrath, who proposed building a pipeline to the Mississippi River to alleviate California’s devastating drought, was expected to have a relatively strong showing in the election, perhaps even challenging the success of Republican Kevin Faulconer, the former mayor of San Diego.

As a fiscal conservative with moderate to liberal positions on social issues, including abortion, immigration and the environment, Faulconer was long seen as the Republican Party’s greatest hope to recapture the governor’s office. But his campaign foundered, in part, because the pro-Trump core of the California Republican Party was solidly behind Elder.

Tuesday night Faulconer blamed the apparent failure of the recall on a mid-campaign shift of focus and the public’s attention away from what critics called Newsom’s shortcomings as governor.

“Here’s the reality: The recall stopped being about Newsom and it turned into a fight over personalities and national politics,” Falconer said at a campaign event in Point Loma’s Liberty Station neighborhood. “Newsom didn’t change, the recall did.”

Candidate and state Assemblyman Kevin Kiley, a Rocklin Republican, said the recall was about creating a movement as much as it was about replacing Newsom. Joining Kiley’s watch party in Lincoln was former U.S. Rep. Doug Ose, who dropped out of the recall race last month after suffering a heart attack.

“We built something more powerful than one political objective,” Kiley said after hearing that some outlets had called the race for Newsom. “I would have liked to have seen the recall be a success. I would have liked to have a new governor. I would have liked to have been that new governor. But, this moment is just getting started.”