RICHMOND, Va. – Lt. Gov. Ralph Northam is on track to win the Democratic nomination for Virginia governor in the primary election Tuesday evening, CNN has projected.

Northam's win capped off fierce competition on the Democratic side, with Northam facing off against former congressman Tom Perriello.

With votes still coming in, the Republican gubernatorial primary remained undecided -- a shocking outcome after a campaign largely dominated by Ed Gillespie. However, with more than half of precincts reporting, Gillespie was only neck-and-neck with Prince William County Board of Supervisors chair Corey Stewart.

In a statement congratulating Northam, outgoing Democratic Gov. Terry McAuliffe linked the Republican field to President Donald Trump.

Tuesday's elections marked the first time both parties held contests on the same day in the commonwealth's history.

A fierce fight

For Democrats, the race had been framed as a reboot of the Bernie Sanders-Hillary Clinton contest.

Some viewed the close battle as a pitting of the Sanders wing of the party, as channeled by Perriello, against the Clinton wing of the party, represented by Northam.

But the comparison was never a perfect fit. Northam had pushed his campaign further to the left and has described Trump as a narcissistic maniac -- while Perriello instead attempted to reach out to Trump voters by selling a message of economic populism framed through a progressive perspective.

Both the Democratic and Republican contests feature established candidates with lengthy political careers facing off against insurgent, populist candidates hoping to upset the power bases of their respective parties.

On the Republican side, former George W. Bush aide Gillespie campaigned off the goodwill he established with Republicans after his narrow loss to Democratic Sen. Mark Warner in 2014. Gillespie worked to tiptoe around the presence of Trump, embracing policies that are popular with Republicans without directly tying his campaign to the President.

Gillespie basically ignored his competition, flame-throwing chair of the Prince William County Board of Supervisors Corey Stewart, and the strategy seemed to work. Most polls showed Gillespie with a double-digit lead before Election Day.

But on election day, Stewart had a big showing.

A third candidate, State Sen. Frank Wagner, struggled to gain traction, despite winning the endorsement of The Washington Post's editorial board.

Justin Fairfax handily beat his two opponents to secure the Democratic nomination for Lieutenant Governor.