Republican Glenn Youngkin has been elected as Virginia’s next governor in a major upset, according to US media projections.
He was 2.1 points ahead of Democrat Terry McAuliffe, with 99% of votes counted.
Mr McAuliffe, who served as governor from 2014-18, saw his opinion poll lead vanish in recent weeks.
The ballot has been widely seen as a referendum on Joe Biden’s presidency, and defeat will unnerve the Democrats.
Mr Biden won by 10 points in Virginia in the presidential election just a year ago.
In a speech to cheering fans, Mr Youngkin promised to get to work straight away to transform the state.
“We work in real people time, not government time,” the Republican declared.
The state’s current, Democratic governor, Ralph Northam, was unable to stand for re-election as Virginia does not allow governors to serve consecutive terms in office.
In more potential good news for Republicans in the state, their candidate, former US Marine Winsome Sears is tipped to become the first black female lieutenant governor of the state, which was the former seat of the pro-slavery Confederacy during the American Civil War.
The Republican candidate for Virginia attorney general, Cuban American Jason Miyares, was also leading that vote count. And Republicans seemed to be closing in on control of the state’s House of Delegates.
In other elections across the US on Tuesday:
Republican challenger Jack Ciattarelli had a narrow lead over New Jersey’s Democratic Governor Phil Murphy, with 88% of votes counted
Amid surging crime, Minneapolis voters rejected a proposal to replace the city’s police department with a new Department of Public Safety, more than a year after the murder of George Floyd by an officer
As expected, Democrat Eric Adams won New York City’s mayoral election to replace his party colleague Bill de Blasio
In other races, voters in Boston elected their first woman of colour as mayor, Michelle Wu, an Asian-American, and Pittsburgh picked its first black mayor, Democrat Ed Gainey
Mr Youngkin is the first Republican elected to statewide office in Virginia since 2009.
The political newcomer focused during the bitterly fought election on crime and the economy, as well as how schools handle race, gender and mask mandates.
Mr McAuliffe campaigned on other cultural issues, such as abortion rights and voting reform.
But the Democrat’s critics hammered him for saying during a debate: “I don’t think parents should be telling schools what they should teach.”
According to exit polls by the BBC’s US partner, CBS, education and the school curriculum were top issues for slightly more than half of all voters.
At a news conference earlier on Tuesday, Mr Biden predicted his party would win the first major election since he took office 10 months ago, but he acknowledged “the off-year is always unpredictable”.
Mr Biden’s popularity has been sliding amid rising inflation, a slow economic recovery, a deadlocked legislative agenda and the aftermath of a disorderly US withdrawal from Afghanistan.
The Democratic president’s approval rating has fallen to 43%, according to an opinion poll average by RealClearPolitics.
The McAuliffe campaign tried to liken the challenger to former President Donald Trump, who remains unpopular in Virginia.
But Mr Youngkin, a mild-mannered private equity tycoon, sought to appeal to moderates by keeping Mr Trump at arm’s length, while tapping into the former president’s supporters in the state.
His balancing act may offer a template for Republicans seeking to win back suburban moderate voters who were turned off by Mr Trump’s firebrand style of politics.
The race could shape party messaging and battle-plans for next year’s mid-term elections, when the Democrats will defend their wafer-thin majorities in Congress, and the 2024 White House election.
Mr Trump thanked his supporters for “coming out in force and voting for Glenn Youngkin”, saying the MAGA movement was “bigger and stronger than ever before”.
The Trump playbook without Trump
By Tara McKelvey, BBC News, Fairfax, Virginia
The restaurant was crowded, with people angling for the best place to watch election returns on big screens, with American flags everywhere.
They had gathered for a watch party, hoping to see their candidate, Glenn Youngkin, a Republican, win the governor’s race.
Over the past several months, he has charted a course for conservatives – he talks frequently about race relations in the US, and has denounced the teaching of critical race theory.
He ran on a law-and-order platform, and opposed mask mandates, and his messaging echoed the kind that Mr Trump uses. But Mr Youngkin kept his distance from the former president.
In this way, Mr Youngkin has appealed to voters who like Mr Trump’s positions, but are uneasy about the man himself.
Mr Youngkin’s approach has helped propel him to a close race, and is likely to guide other conservatives in their campaigns for the congressional midterms.