RICHMOND, Va. (Reuters) - Virginia’s lieutenant governor will face a former Republican national committee chairman in a November general election to become the state’s next governor in a race seen as a bellwether for next year’s mid-term congressional races.

Slideshow ( 7 images )

Lieutenant Governor Ralph Northam bested former congressman Tom Perriello in the Democratic primary, while former Republican National Committee Chairman Ed Gillespie topped President Donald Trump’s former Virginia campaign co-chairman Corey Stewart, according to unofficial returns posted online by the Virginia Department of Elections.

The gubernatorial race in Virginia, the only state other than New Jersey electing a new governor this year, is seen as a key test of Trump’s popularity ahead of the 2018 mid-term elections for the Republican-controlled U.S. Senate and House of Representatives.

The winner in November will succeed incumbent Democratic Governor Terry McAuliffe, who is barred by term limits from running again.

Northam sought to stoke Democrats’ anger toward Trump, calling the president a “narcissistic maniac” in statewide ads.

“Tonight, we’re one step closer to building a Virginia that works for everyone - no matter who you are, no matter where you’re from,” Northam said in a Twitter post declaring victory.

In the Republican primary, Gillespie beat Stewart 44 percent to 42 percent with Frank Wagner earning 14 percent of the vote. On the Democrat side, 56 percent vote went to Northam and 44 percent went to Perriello, unofficial returns showed.

The governor’s race in Virginia, a swing state where a recent Washington Post and George Mason University poll showed 59 percent of voters disapprove of Trump’s performance, is shaping up as a pivotal battleground with national implications.

“Virginia will be more hotly contested than ever,” said Stephen Farnsworth, a University of Mary Washington political analyst. “All the national money and national attention will be coming this way. ... Republicans want to claim that the Trump movement is doing well and the Democrats want to claim it is not.”

Northam was backed by every statewide Democratic officeholder, while Perriello drew support of Democratic progressives, including U.S. Senators Bernie Sanders and Elizabeth Warren.

Gillespie was endorsed by a raft of state and national Republican leaders. On the campaign trail, he largely avoided talking about Trump, who has not weighed in on the race.

Republican strength has eroded in recent Virginia elections, with Democrats now holding all statewide offices. Virginia, once a Republican bulwark in presidential polls, has gone Democratic in three straight elections.