Mr. McAuliffe, who previously served as governor, overcame four rivals, benefiting from the support of the party establishment. His victory set up a general election race against a wealthy Republican, Glenn Youngkin.

MCLEAN, Va — Former Virginia Gov. Terry McAuliffe captured the Democratic nomination for his old job on Tuesday, easily dispatching four party rivals to set up an expensive general election that will test how liberal Virginia has become and present the first major referendum at the ballot box on the Democratic Party under President Biden.

Mr. McAuliffe was winning more than 60 percent of the vote when The Associated Press declared him the winner less than an hour after the polls closed. Jennifer Carroll Foy, a former state lawmaker, was running a distant second with about 20 percent, followed by State Senator Jennifer McClellan, Lt. Gov Justin Fairfax and state Delegate Lee Carter.

“We are a different state than we were eight years ago and we are not going back,” Mr. McAuliffe said after taking the stage alongside his successor, Gov. Ralph S. Northam, and other elected Democrats.
Coming the year after the presidential election, and with few other significant contests on the ballot, Virginia’s governor’s races are always seen as a political temperature check on the party that just won the White House. And 2021 could prove particularly revealing here.

Mr. McAuliffe will face the Republican Glenn Youngkin, a former private-equity executive and first-time candidate, in November.

Positioning himself as a political outsider and having already spent $12 million of his own fortune, Mr. Youngkin is poised to make Virginia the most competitive election in the country this fall. He’s linking Mr. McAuliffe and Mr. Northam to argue that Virginia Democrats have taken a moderate state sharply to the left since gaining total control of the State Capitol.

Recognizing the threat Mr. Youngkin poses, Mr. McAuliffe devoted a significant part of his victory speech to attacking his opponent, linking the financier to former President Donald J. Trump and outlining his conservative views on cultural issues.

Warning Democrats not to be complacent, the former governor said “there are 75 millions reasons why Glenn Youngkin could win,” a reference to the amount of money the Republican could spend on the race. “Remember, folks, it could work.”

In one promising sign for Democrats after what was a fairly sleepy primary, during which Mr. McAuliffe was never at serious risk, turnout Tuesday was robust. About 500,000 Virginians cast a ballot, a number far closer to the 2017 primary, when Democrats won the governorship, than in 2009, when they were routed.

Virginia Republicans, however, are at a low ebb. Not only are they shut out of every statewide office, but, like in other Democratic-leaning states, they are also struggling with how to navigate the dominating presence of Mr. Trump, who remains beloved among party activists but is despised by the broader electorate.

Further complicating matters for Republicans here, both Mr. Northam, who by state law cannot succeed himself, and Mr. Biden are popular with Virginia voters. The president carried the state by 10 points last year. And just two years after a blackface scandal that nearly drove him from office, Mr. Northam, who succeeded Mr. McAuliffe, was perhaps Mr. McAuliffe’s most important supporter in the primary, appearing with him in television commercials and on the campaign trail.

Indeed, Tuesday’s results represented an emphatic vote of confidence among Democrats in their last two governors.

Virginia’s governor’s races are always seen as a political temperature check on the party that just won the White House the year before.
Alyssa Schukar for The New York Times

The results also marked a moment of vindication for Mr. Northam, underscoring his political recovery in a party whose leaders, including Mr. McAuliffe, once called for his resignation. And the outcome was even sweeter for Mr. McAuliffe, who deferred his presidential ambitions to Mr. Biden, for now at least, to try to reclaim the governorship four years after leaving Richmond with some of his plans stymied by a statehouse then controlled by Republicans.

The exuberant former fund-raiser and national party chair could barely conceal his glee before Tuesday, as he barnstormed Virginia in the days leading up to the primary by ignoring his Democratic opponents, lacerating Mr. Youngkin and going viral with dance moves that were more enthusiastic than artful.

Mr. McAuliffe’s easy victory also highlighted the enduring strength of the Democrats’ moderate wing in a state that has turned a deeper shade of blue in the last decade. The former governor’s opponents, particularly Jennifer Carroll Foy and Lee Carter, ran to his left, arguing that a 64-year-old wealthy white man with pro-business inclinations was out of step with the party. Three of Mr. McAuliffe’s primary rivals are Black: Ms. Carroll Foy, Jennifer McClellan, a state senator, and Lt. Gov. Justin Fairfax.

With Mr. Trump refusing to acknowledge defeat and the country only recently starting to fully emerge from the pandemic, though, the primary was obscured and Mr. McAuliffe’s rivals were starved of political oxygen. The once and potentially future governor also helped himself by claiming early and broad support from the state’s Democratic establishment, including a number of leaders in the Black community. And with all four of the other candidates remaining in the race to the end, none of them were able to coalesce what opposition there was to Mr. McAuliffe.

His rivals hoped the contest would mirror the 2008 Democratic presidential primary, when former President Barack Obama emerged as the next-generation hope of the party and defeated the standard-bearer of the old guard, Hillary Clinton, whose campaign Mr. McAuliffe chaired. But this primary more closely approximated last year’s presidential primary, when a coalition of moderate whites and Black Democrats rallied to the moderate candidate they knew.

“Terry is a little more experienced,” said John Eley III, a McAuliffe supporter and member of the Newport News School Board. “Coming out of the pandemic you really need someone with experience to take us forward and continue to move Virginia in the right direction.”

Alyssa Schukar for The New York Times

The question for Virginia voters this fall is whether they’ll favor a former governor with decades of high-level political experience — Mr. McAuliffe would be only the second person in state history to win nonconsecutive terms — or somebody who’s never before been on the ballot.

A Hampton Roads native who, like Mr. McAuliffe, now lives in the affluent Washington suburbs, Mr. Youngkin is casting himself as somebody who will bring a businessman’s touch to state government. The former head of the global investment firm the Carlyle Group, Mr. Youngkin poses a challenge to Democrats because of both his willingness to spend his own cash on the race and his lack of a voting record that can be targeted.

His hope is that, two years after Virginia Democrats won the state House and took full control of the State Capitol, voters will want to put a check on what is now the majority party here.

“Terry McAuliffe and his sidekick, Ralph Northam, have been pursuing a politics of extremism and political division,” Mr. Youngkin said at a rally in Richmond last month.

Mr. Youngkin, however, has accepted an endorsement from Mr. Trump, and Mr. McAuliffe has made clear he will try to tie his Republican rival to a former president whose incendiary style of politics is repellent in Virginia’s vote-rich suburbs.

He also will have to dig deep into his donor list to keep pace with his self-financing opponent, something Virginia Democrats predicted he would do with relish. “Terry will raise whatever it takes, he’ll raise $70 to $100 million if he has to,” said Richard Saslaw, the State Senate Majority Leader.

Beyond the governor’s race, Republicans have elevated a Black woman who served in the state House, Winsome Sears, as their nominee for lieutenant governor and a Cuban American state legislator, Jason Miyares, to run for attorney general.

In another sign of Mr. Northam’s popularity with his party, Democrats nominated his preferred candidate, state Delegate Hala Ayala, for lieutenant governor. Democrats also renominated Attorney General Mark Herring to what would be his third term.