Washington (CNN) An early referendum on President Donald Trump's agenda. A recently red state that has rapidly turned purple. And a potential harbinger for the 2018 midterm elections.

The race for the governor's mansion in Virginia on Tuesday likely marks the most consequential race of the year: Democrat Ralph Northam and Republican Ed Gillespie are squaring off in a battle that will provide an early look at how the first 10 months of the Trump presidency have reshaped American politics.

Northam, a pediatric neurologist, has served as the state's lieutenant governor the past four years under Democratic Gov. Terry McAuliffe, who can't run for another term. Gillespie is a one-time chairman of the RNC and counselor to former President George W. Bush who nearly stole Mark Warner's Senate seat in 2014 in a race few expected would be close.

But Republicans will face an uphill climb: Democrats have won seven of the last eight statewide contests in Virginia, boosted by the party's overwhelming success in the Northern Virginia suburbs outside Washington. The last Republican to win statewide was Bob McDonnell, who trounced Democrat Creigh Deeds by 17 points in the 2009 gubernatorial race. Since then, Democrats have won five consecutive races — all by single digits.

One potential bright spot for the GOP? When McAuliffe claimed victory in the Virginia gubernatorial contest four years ago it ended a streak of nine governor's races — dating back more than three decades — in which Virginians elected a governor from the party opposite the one that won the White House the previous year.

The race in Virginia is the only competitive gubernatorial contest this fall, barring a major turn of events in New Jersey, where polls show Democrat Phil Murphy comfortably ahead of Republican Kim Guadagno.

So will voters in the commonwealth revert to form and select Northam — who called President Donald Trump a "narcissistic maniac" on his way to winning the Democratic primary in June? Or will Gillespie, who has been reluctant to fully embrace the President despite echoing some of Trump's campaign themes, start a new trend by taking the governor's mansion in Richmond a year after Trump won the White House?

Taken together, these past results — and how they were determined — provide a roadmap for looking at this year's race.

Beltway Blues: Alexandria, Arlington and Fairfax

It is here in voter-rich Northern Virginia — the densely-populated, affluent and highly-educated suburbs a stone's throw from the nation's capital — where Northam will likely need victory margins as long as the commutes in these parts if he is going to become the state's 73rd governor.

The area has proved key in carrying Democrats in presidential races: Hillary Clinton outperformed Barack Obama's 2012 showing in Alexandria, Arlington and Fairfax, surpassing 75% in the first two and winning nearly 65% of the vote in Fairfax. (In 2012, Obama won roughly 70% of the vote in Alexandria and Arlington and just shy of 60% in Fairfax.)

Statewide Democrats have charted a similar course to victory. McAuliffe cleared 70% in Alexandria and Arlington while falling just short of 60% in Fairfax in his 2013 defeat of Republican Ken Cuccinelli. Warner did the same in his 2014 win over Gillespie.

But one big potential factor here is how much opposition to Trump might motivate Democrats to show up to the polls for Northam in an off-year race when the electorate is typically more conservative. Most previous special elections in congressional districts across the country so far this year have shown Democrats tightening margins in typical-GOP areas.

In terms of raw numbers, Democrats' totals here often far surpass their statewide raw margins. McAuliffe bested Cuccinelli by more than 68,000 votes while Warner netted more than 53,000 votes against Gillespie in Fairfax alone — both more than their overall statewide margins.

Trump Country: Washington, Pittsylvania and Virginia Beach

To offset the wide Democratic margins in Northern Virginia, Gillespie will need to run up the score in the more rural parts of of the commonwealth, particularly in the southwest and Southside regions.

The southwest part of Virginia is just 300 miles from Northern Virginia as the crow flies, but culturally, it's light years away. Home to bluegrass music and spectacular views of the Blue Ridge Mountains, gospel hymns and coal mines, this economically-depressed region has shown overwhelming support for Republicans in recent elections — especially Trump.

The question looming here is whether voters who turned out for Trump will show up for Gillespie, a candidate with decades-long ties to the GOP establishment.

Despite his need for a big showing in these counties, Gillespie has kept his distance from the President. His campaign did not retweet a Trump endorsement when he delivered it on Twitter in early October. But Gillespie is still wooing Trump voters, campaigning with Vice President Mike Pence at a rally in Abingdon, located in the southwest county of Washington.

Trump won Washington County by more than 50 points with nearly 75% of the vote. McDonnell posted similar numbers in his successful 2009 run, while Mitt Romney and Cuccinelli received roughly 70% of the vote in the county with margins of more than 40 points. During his 2014 Senate run, Gillespie took 67% of the vote to defeat Warner by 35 points in the county.

These small counties in the southwest don't hold as many votes as those in Northern Virginia, but there are more of them. And with margins so wide, those votes can add up for Republicans.

Taking the 19 counties and four cities that make up the southwest region (using the list from the Southwest Virginia Cultural Heritage Commission) as a whole, Gillespie received about 36,000 more votes there than Warner in 2014. But, keep in mind, that is about 17,000 votes less than Warner cleared just in Fairfax.

That means Gillespie will also need to build up his margins in Southside counties like Pittsylvania. He won it with 62% of the vote in 2014, but that lagged behind other Republican candidates, including McDonnell, who topped 71% in the county.

Another reliably Republican piece of the Virginia map is Virginia Beach. The area doesn't provide the overwhelming margins that are found in the southwest and Southside, but there are lots of votes to be had there. With the exception of McDonnell, the other four Republican candidates — Trump, Gillespie, Cuccinelli and Romney — all won it by single digits. McDonnell, meanwhile, claimed the city by more than 27 points over Deeds in his big 2009 win.

Swing Suburbs: Henrico, Loudoun and Prince William

As is often the case in statewide races, the battle for Virginia governor this year will likely be handled in a handful of key suburbs.

The two that get an outsized amount of attention in Virginia are the DC exurbs of Loudoun and Prince William — and rightfully so. Both contain a large number of votes and have a fairly reliable record in predicting the winner of the race.

Prince William has gone to the winner in all five races we are looking at — and Loudoun has sided with the winner in four of the five. The one outlier? When Gillespie eked out a win in Loudoun by 458 votes — out of more than 90,000 cast — but lost the state by a hair.

Clinton and McDonnell both won these counties by double digits in their wins, while McAuliffe beat Cuccinelli by single digits on his way to more narrow victory in 2013.

Gillespie will likely need to keep things close here — as he did in 2014 — if he is going to end up with a different result. Northam, meanwhile, doesn't need a blowout here like in the Clinton-Trump matchup a year ago. But results more along the lines of Obama in 2012 or McAuliffe in 2013 instead of Warner in 2014 would be a welcome sight for the Northam campaign on Election Night.

Another county to keep an eye on is Henrico, near the capital city of Richmond. Unlike in Loudoun and Prince William, Gillespie failed to keep it close there, losing by 13 points to Warner, a margin similar to the losses by Romney and Cuccinelli in the county. Trump was blown out by Clinton in Henrico by 20 points.

Gillespie's double-digit defeat in 2014 translated to a gap of nearly 13,000 votes — making up a good chunk of his 18,000-vote losing margin.

Gillespie might not need to do as well as McDonnell in Henrico, but a stronger showing than his previous run could be consequential, especially if he is able to replicate his performance in some of the other battleground areas of Virginia.