Republican candidate Glenn Youngkin pulled off a stunning upset to win the governor's mansion in the US state of Virginia, US television networks projected.
The race was seen as an early verdict on President Joe Biden's first year in office.
Mr Youngkin was 2.7 points ahead of Democrat Terry McAuliffe in the neck-and-neck tussle shortly after midnight, with more than 95% of the vote counted.
It prompted NBC, CNN and ABC to call the election for the Republican.
A harbinger of the parties' prospects in next year's midterm elections, the race was initially expected to be a comfortable Democratic win, but instead became a toss-up in the closing days of the campaign.
A private equity multi-millionaire who has never run for office defeating a former popular Democratic governor will be seen as a disaster for Mr Biden going into the all-important 2022 races that will determine who controls Congress.
"All right Virginia - we won this thing! How much fun!" Mr Youngkin, who poured at least $20m of his own fortune into the race, told cheering fans after dancing onstage to Norman Greenbaum's 1969 hit 'Spirit in the Sky'.
Calling his victory a "defining moment," the newcomer told the crowd: "Together, we will change the trajectory of this commonwealth. And friends, we are going to start that transformation on day one."
We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences
Read More:
Warning signs for US Democrats ahead of 2022 midterms
The election, a neck-and-neck tussle for weeks, resonated nationwide as a proxy war between Mr Biden and former president Donald Trump, who gave Mr Youngkin his early backing.
Mr Youngkin's campaign will now likely become a blueprint for Republicans across the country as they strategise on how to leverage Mr Trump's base while avoiding becoming tainted by his toxic brand among moderates in the midterms.
The Democratic faithful had badly wanted the race to be a referendum on Mr Trump but in reality he had little to do with the campaign and was never likely to prove the galvanising nemesis they had hoped for.

Early in the campaign, Mr Youngkin accepted Mr Trump's endorsement and steered clear of criticising the twice-impeached former president.
But he also pointedly avoided standing next to the Republican leader, who is seen as beyond the pale among independents in much of Virginia, or presenting himself as a Trump acolyte.
Mr McAuliffe's loss will also almost certainly spook moderates on Capitol Hill and drive some away from supporting Mr Biden's stalled $3 trillion vision for remaking the economy.
The long delays on passing promised social welfare and infrastructure packages are an echo of 2009-10, when the Democrats suffered big losses amid gridlock in Washington.
Elections were also being held in multiple other states, with voters overwhelmingly backing Democrat Eric Adams for mayor of New York and Democratic New Jersey Governor Phil Murphy just behind in a surprisingly close reelection battle he was nevertheless expected to win.
But Virginia is where the battle lines had been most visibly drawn.
Mr McAuliffe faced significant headwinds as he tried to mount a return to an office he held four years ago, with the majority party in Washington usually incurring losses during a president's first term.
Mr Youngkin had to perform his own high-wire act, as the vast majority of Republicans believe Mr Trump's false claims that the presidency was stolen in a fraudulent election, making acknowledging the truth politically risky.
He turned the conversation instead to local "culture war" issues such as abortion, mask mandates and the teaching of the US's racial history.