James City and York counties and Williamsburg followed the statewide mold, picking the state's current lieutenant governor in Northam and leaning toward former Republican National Committee chairman in Gillespie, according to unofficial results from the Virginia Board of Elections.

In a statement Tuesday night, the Republican National Committee congratulated Ed Gillespie on his win: "Today's primary concludes a nasty race to the left by Democrats, while Virginia Republicans emerge unified and ready to win", RNC Chair Ronna Romney McDaniel said.

Northam wound up handily defeating former U.S. Rep. Tom Perriello, who ran as an unapologetic liberal crusader supported by prominent national Democrats like Sens. Perriello won big-name endorsements like Senators Bernie Sanders and Elizabeth Warren, along with a host of former Barack Obama aides, but little from inside the state.

Northam led the Democratic race with 55.9 percent, earning a wider than expected victory over Perriello, who only earned 44.1 percent.

Virginia is one of only two states electing governors this year, and the contest in the swing state that went for Hillary Clinton in November has received national attention. Are they going to make Trump the focus of every contest, or is their path back to power through local issues?

Northam's substantial advantage in campaign cash - he appears to have spent about $8 million to Perriello's $4 million - allowed him to clog the airwaves with commercials that hit on multiple themes: resistance to Trump and support for abortion rights and gun control, issues on which Perriello, as a congressman from a rural area, had been squishy.

Mr. Perriello finished the campaign Monday with a series of stops in Northern Virginia, including a final rally with Khizr Khan, the Muslim father of slain United States Army Captain Humayun Khan, and who became a major critic of Mr. Trump in the 2016 election.

Virginia Republican gubernatorial hopeful Ed Gillespie greets voters mid-afternoon at the polls at Glen Allen High School, near Richmond, Va., on primary day across the state on Tuesday June 13, 2017.

More news: Previewing the Essex Vase greyhound racing extravaganza

Kevin Felty, a Norfolk Republican, said he voted for Gillespie because of his fundraising prowess in what's likely to be a bloody general campaign. "We've been backing down too long".

"I'm shocked. If Donald Trump didn't carry the state of Virginia, I don't know how Corey is going to", Nancy Russell, former Hanover County chairwoman said.

Stewart has run a controversial campaign, pledging to fight the removal of Virginia's Confederate memorials and to crackdown on illegal immigration, and pledging his loyalty to Trump and his policies.

But a primary challenge from the right has forced Gillespie into some uncomfortable territory as he would much rather look ahead to the general election.

In the most crowded Democratic primary, four candidates faced off for the chance to take on Del. Now the critical question is whether Stewart supporters will turn out for Gillespie in November.

Northam said Perriello called him to concede the race. "I trust his dedication to all Virginians", Lee said of Northam. Bob McDonnell. He served as counselor to President Bush during Bush's second term of office, co-founded a bipartisan lobbying firm and in 2014 narrowly lost a bid for Virginia's U.S. Senate seat to Democratic incumbent Mark Warner.

Northam, a well-liked pediatric neurologist, had a huge head start on Perriello on the trail and in money raised. In other words, Northam may be what Virginia voters believe a progressive candidate to be, while Perriello seems to represent progressive Washington D.C.'s idea.

Many voters, though, flocked to Northam because of his experience in the General Assembly as a state senator and lieutenant governor.