Donald Trump is not on the ballot in Virginia. He hasn’t campaigned in the state and is out of the country on election day, but his presence is unmistakable as voters head to the polls on Tuesday.

Virginia’s gubernatorial election is the first major statewide race since Trump’s 2016 victory and the race has become a Rorschach blot for those trying to determine the new contours of the American political landscape.

The Democrat Ralph Northam has a narrow lead over his Republican rival, Ed Gillespie, in a race that strategists on both sides think should never have been this close. “Northam had all the tail winds pushing him forward,” said Pete Snyder, a prominent Virginia tech entrepreneur who serves as chair of Gillespie’s campaign.

Virginia has trended increasingly Democratic in recent cycles. It hasn’t elected a Republican to statewide office since 2009 and the state voted for Hillary Clinton in 2016 even as Trump won the White House.

Further, Gillespie seemed mismatched to the current mood in the Republican party. The former head of the Republican national committee and once one of the most powerful lobbyists in Washington, Gillespie only narrowly fended off a primary challenge from Corey Stewart, a local elected official who was fired as Trump’s state co-chair after leading a protest outside the RNC in the aftermath of the Access Hollywood tape when he felt the party was insufficiently supportive of Trump.

However, the race has stayed tight as Gillespie has pressed issues like immigration and Confederate monuments in campaign ads while sticking to a message of economic development on the stump.

In contrast, Northam, Virginia’s lieutenant governor, has stumbled in recent days, seeming to flip-flop on the issue of sanctuary cities and facing a furor over a controversial ad run by an outside group that features a driver in a pickup truck with a Confederate flag and a Gillespie sticker trying to chase down Hispanic children.

The controversial ad by the Latino Victory Fund.

The result has been a sense of panic in some Democratic circles that the candidate could lose. This was celebrated by Republicans such as Mark Obenshain, a state senator who played pundit at a campaign event on Monday, attacking Northam for his lack of “a consistent message” and celebrating the Democratic “circular firing squad”.

While Gillespie’s ads have struck Trumpian themes, the candidate has consistently avoided questions about the president and doesn’t mention his name on the stump. At an event on Monday in a campaign office in a strip mall in Chesapeake, Virginia, Trump’s name didn’t cross the candidate’s lips once, there was no mention of his name in literature and when a reporter asked Gillespie about the president, the Republican candidate ignored the question.

The only time Trump was mentioned at the gathering of three dozen people, many of whom were local Republican elected officials, was when a state legislator said that Northam’s criticism of Trump could hurt Virginia. “We’ve got to have a governor with a close working relationship with the executive branch in Washington DC,” said a local state senator, Frank Wagner. He referenced a campaign ad in the primary election in which Northam turned to the camera and called the president “a narcissistic maniac” and then said jokingly: “Thank God Donald Trump doesn’t hold a grudge.”

Snyder dismissed the impact of Trump on the race and said voters did not care about national politics. “If you go out on the campaign trail … you don’t hear nary a question about what’s going on in Washington. This is solely focused on Virginia’s economy and public safety.”

While Gillespie has remained quiet about Trump, the president has weighed in on the race in several tweets, including one sent from Japan on Monday afternoon, in which he claimed: “The state of Virginia economy, under Democrat rule, has been terrible. If you vote Ed Gillespie tomorrow, it will come roaring back!” The Virginia economy had an unemployment rate of 3.7% in September, better than all but 13 states and below the national rate of just over 4%, Reuters has reported.

Virginia’s lieutenant governor, Ralph Northam, greets supporters during an election rally in Richmond on Monday. Photograph: Julia Rendleman/Reuters

In contrast, Trump was invoked repeatedly at a Democratic rally in Norfolk the night before the election. Speaking in a restaurant in a waterfront development as crowds ate complimentary truffle grilled cheese sandwiches and Italian meatballs, the race was framed as a progressive crusade. Governor Terry McAuliffe told the crowd to vote to “send a message to Donald Trump and Eddie Gillespie that racism and bigotry will not be tolerated, not here, not now, and it will not happen in Virginia” while accusing the Republican candidate of running “mean-spirited, bigoted, racist ads”.

Michael Blake, a vice-chair of the Democratic National Committee, explicitly compared Gillespie’s campaign to Trump’s. “Gillespie has been very clearly running a Trump-like campaign … it’s clear race-baiting, nothing on the issues.”

In an interview with the Guardian, Northam echoed many of these criticisms. “I don’t think Virginia has ever witnessed as negative a campaign as Ed Gillespie is running, things like ads saying that I support MS-13 gangs. I mean, come on.” The pediatrician and military veteran went on to bash his opponent for running a campaign “that’s based on hatred and bigotry”.

Northam also insisted that he would try to work with Trump on issues of mutual agreement like “building up the military”. When asked how he would work with someone he had so pointedly attacked, the Democratic candidate said: “I’m a neurologist, so I’m used to dealing with a lot of different minds – and even being a pediatric neurologist, that gives me more perspective.”