Gillespie criticized Northam on issues that included Latino gangs, sanctuary cities and the fate of monuments to Confederate figures -- all issues that played on race and replicated Trump's own approach in 2016.
Northam pushed back on the incendiary arguments with less heated appeals on the economy, education and transportation, although he also took fire for an allied Latino group's ad that implied Gillespie supporters were threatening young minority children.
The race at times echoed the presidential contest in a state won last year by Hillary Clinton: a Republican willing to employ brash tactics against a Democrat so low-key that his allies worried voters might respond in kind.
Obama hit that concern hard in a mid-October visit to Richmond intended to encourage turnout by African-American voters.
"Elections matter. Voting matters," he told thousands of supporters. "You can't take anything for granted. You can't sit this one out."
Both sides expressed wary confidence about a race that in the last several weeks remained a toss-up in polls.
The Republican "ground game never left Virginia, despite an unfavorable outcome in 2016," said Rick Gorka, a spokesman for the Republican National Committee.
Republicans and Democrats alike mounted efforts that knocked on millions of doors in person-to-person persuasion, while the state's airwaves blared with advertisements until the last minute, trying to convince a narrowing number of undecided voters.
"Virginia will be the most important bellwether of what the party is doing in 2018," said Keith Brannum, the campaign manager for Elizabeth Guzman, the Democratic candidate in one of several highly contested House of Delegates seats.
"It will be the test of whether the enthusiasm for Democrats can be translated into votes, and translated into an electoral coalition."
(c)2017 Los Angeles Times
Visit the Los Angeles Times at www.latimes.com
Distributed by Tribune Content Agency, LLC.