Democratic nominee Ralph Northam and Republican nominee Ed Gillespie will vie for governor in November.
Northam won the Democratic nomination in Virginia's closely watched race for governor, defeating an insurgent challenger backed by U.S. Sens. Bernie Sanders and Elizabeth Warren.
Northam beat former U.S Rep. Tom Perriello by more than 11 percent.
The lieutenant governor secured victory thanks in part to his longer time on the campaign trail and fundraising advantage. Northam had the support of the state Democratic Party's core constituencies, including teachers groups and African-American political and religious leaders.
Northam had particularly strong support from some abortion rights and gun control groups, advocates from two areas where Perriello had baggage from past votes in Congress.
Gillespie is a former Republican National Committee Chairman who had a huge fundraising advantage and enjoyed the solid backing of most state elected Republicans, but largely kept Trump at arm's length during the campaign.
On Tuesday, he edged out Corey Stewart, a former Trump state campaign chairman who made preserving Virginia's Confederate history a top campaign issue, by 1.2 percent. Stewart has not conceded the race, but the Associated Press called the race for Gillespie.
The close results shocked many political watchers and shows Trump's enduring appeal among Republican voters in Virginia.
Meanwhile, Democratic nominee Justin Fairfax and Republican nominee Jill Vogel will battle it out for lieutenant governor.
Also, C.T. Woody Jr. has been knocked out of the running for Richmond sheriff by Antoinette Irving.
Virginia's gubernatorial contest has received widespread national attention as the swing state is one of only two states electing new governors this year.
2017 June Republican Primary
Edward W. "Ed" Gillespie -- 160,039, 43.71%
Corey A. Stewart -- 155,716, 42.53%
Frank W. Wagner -- 50,345, 13.75%
Jill H. Vogel -- 151,849, 42.76%
Bryce E. Reeves -- 142,141, 40.02%
Glenn R. Davis Jr. -- 61,157 17.22%
2017 June Democratic Primary
Ralph S. Northam -- 303,429, 55.90%
Tom S. Perriello -- 239,244, 44.10%
Justin E. Fairfax -- 252,319, 49.14%
Susan S. Platt -- 201,154, 39.17%
Gene J. Rossi -- 60,008, 11.69%
Richmond City Sheriff
Antionette V. Irving -- 13,586 , 51.57%
C.T. Woody Jr. -- 12,760, 48.43%
Voter turnout for Virginia’s primary election has been generally slow and intermittent, according to Richmond, Chesterfield and Henrico election officials. Turnout across RVA is about 10 to 14 percent of all registered voters, as of late Tuesday afternoon. Primary turnout is considerably lower than general elections, as Democrats and Republicans choose their nominee for Virginia’s next governor and lieutenant governor, among several other contests.
There have not been many technical polling issues throughout the day, with some minor parking snags in Henrico and a couple ballot-scanning machines temporarily stalled in Chesterfield.
"At one precinct, it was simply the jostling of the machines going to the precinct, and it just stopped taking ballots. And we reset it, and it’s been working fine ever since… The other precinct had password issues. And they were able to get that back online,” said Chesterfield Registrar Constance Tyler.
However, there was campaign drama in Church Hill, according to Richmond General Registrar Kirk Showalter. Friction between two Democratic campaigns vying for the 70th District House of Delegates seat prompted several calls to police and the Board of Elections.
Campaign heads for candidate Alex Mejais alleged workers for current Del. Delores McQuinn, D-Richmond, were within 40 feet of some polling spots, which is illegal. Officials ultimately determined where the line legally starts.
Copyright 2017 WWBT NBC12. All rights reserved. The AP contributed to this report.