Six years ago, Democrat Mark R. Warner won all but six of Virginia’s 133 cities and counties in a landslide election that earned him his first term in the U.S. Senate.

On Tuesday, Warner’s victory map was starkly different: a sea of red across the state’s rural parts but enough deep blue speckled through Northern Virginia, Richmond and Hampton Roads to push him — barely — across the finish line.

Warner and his allies attributed his narrow win, which Republican Ed Gillespie still may challenge, to a vastly different national mood that allowed Republicans to take control of the Senate largely by tying their opponents to the unpopular policies of President Obama.

But what is also clear from that margin — and from the final weeks of the campaign — is that Warner’s operation didn’t really adapt to the partisan reality of the new mood. A self-described “radical centrist” who prided himself on his appeal among Republicans and independents, Warner steadfastly continued to court those voters despite strong evidence that their tolerance for Democrats had dramatically waned.

Warner also may have missed out on a new advantage for politicians with D’s after their names in Virginia’s changing demographic landscape.

Republican Ed Gillespie gives remarks at his election night party in Springfield, Va. (Kate Patterson/For The Washington Post)

By positioning himself as a moderate, he may have missed a chance to gin up more enthusiasm within the state’s expanding Democratic base, earning fewer votes in such deep-blue communities as Arlington County and Alexandria than left-of-Warner Gov. Terry McAuliffe (D) did a year ago.

All of it has left some to wonder whether Warner would have won bigger if he had eschewed the middle and embraced the left, and whether the winning path for moderates that Warner forged during his own bid for governor 13 years ago is becoming extinct.

“I think if you look at the returns around the country . . . it raises questions about just how successful the bipartisanship brand really is,” Rep. Gerald E. Connolly (D-Va.) said Tuesday after easily winning a fourth term in Northern Virginia’s 11th Congressional District by talking about women’s rights, immigration reform and climate change — and less about working with Republicans.

“We all say we want it, but that’s not how we’re voting tonight,” Connolly said. “It’s not how we voted in 2010, and so I wish there were more of a reward for Warner’s brand. I know he’s sincere. I know that’s how he wants to govern, but look at who’s getting elected tonight — Tom Cotton, a bipartisan? I don’t think so. Mitch McConnell [the Senate’s presumed next majority leader] getting reelected, a bipartisan? I don’t think so.”

With all but one precinct reporting, Warner’s margin of victory settled at nearly 17,000 votes out of more than 2 million cast in his race for a second term against Gillespie, according to results compiled by the Associated Press. Warner held 49.2 percent of the vote, just slightly ahead of Gillespie’s 48.4 percent.

Warner declared victory over Gillespie late Tuesday, but the contest was so close that Gillespie declined to concede. Gillespie may ask for a recount once the votes are certified by state election officials, a process that election officials expect to complete Nov. 24.

“We owe it to the voters of Virginia to respect the canvassing process that is underway to get an official result,” Gillespie, a former Republican National Committee chairman, said Wednesday. “We will be watching the results closely so that we can ensure Virginians have confidence in the accuracy of the results.”

A blue Virginia tide turns red for 2014

In Virginia, the loser can ask for a recount if the margin is less than 1 percent of the total number of votes cast — which it is, so far, in the Senate race. But the state would pay for the recount only if the margin falls below one-half of 1 percent of the votes cast — a threshold that the current results do not meet.

Marc Erik Elias, an election attorney working for the Warner campaign, said a recount would be unprecedented, and probably unsuccessful, given the senator’s current lead. Like the Gillespie campaign, Warner’s team is monitoring the canvassing process across the state.

In Fairfax County, the state’s largest jurisdiction and where 1 in 7 votes were cast, Warner was ahead by about 53,000 votes, election officials said Wednesday. Volunteers from both parties began a canvass of results that is expected to last until Friday afternoon. By the end of Wednesday, Warner had gained about 500 votes after a few errors were found in four precincts, officials said.

The playbook that allowed Warner to dominate the commonwealth’s old electoral map barely worked Tuesday in Virginia, where some once-blue, union-friendly counties are now deep red — and vote-rich Northern Virginia is the place that delivers Democrats their wins.

That’s how McAuliffe did it last year — and how Sen. Timothy M. Kaine did it the year before.

They also did it by throwing out more partisan rhetoric to jazz up Democratic voters — something some Warner confidants suggested that he do, too.

“I was an advocate of him introducing more base red-meat topics, and he resisted because he is still speaking to the ‘radical centrist’ voter,” longtime adviser Ellen Qualls, who helped Warner prepare for debates, said before the election. “I wanted him to talk a lot more about personhood and birth control than he actually does.”

Instead, aside from a few debate references, Warner helped Gillespie stay away from such divisive issues as abortion and same-sex marriage. Warner’s TV commercials were silent on those issues, too.

“My path has been very different from Terry’s or Tim’s or others’,” Warner said in an interview with The Washington Post before the election. “To the annoyance of some of my so-called staff, I’m going to Abingdon and Russell County now because Southwest Virginia gave me a start, and I’m not going to cede one part.”

The counties in that region voted for Gillespie, sometimes by more than 30 points over Warner. Kaine, also a former governor, noted the slim margin with a little self-deprecating humor while introducing Warner to his election night crowd: “So the results are in, and we won! This is like a Tim Kaine election night.”

Warner has given no indication that he plans to change course in the newly Republican-controlled Senate, either. If anything, he expects to have more room to reach bipartisan accord now.

“I’m going to stay focused on that, because that has to be the promise if this country is going to stay the kind of country that I think it should stay — that you shouldn’t be kind of geographically challenged, you should have choice and opportunity everywhere,” he said.

He has made no secret of his disdain for the culture of gridlock on Capitol Hill. Asked last weekend whether McConnell (R-Ky.) could make life in the Senate more rewarding, Warner shared a recent conversation with Sen. Bob Corker (R-Tenn.).

“Bob Corker’s a dear friend of mine. He has been in the middle of everything the last few years. He said, ‘Warner, I know you want the Democrats to win, but who knows what kind of . . . ’ ” Warner said, trailing off.

Prodded for more, Warner stood, raised his arms and let loose a tirade against the kind of partisanship that he says would never fly in the business world.

“I think there are enough of us in both parties who realize that this process that one side puts up an ideological bill and the other side filibusters and it’s rinse and repeat and we never get to debate . . . ” he said. “I don’t want this job to vote on deputy secretaries and ambassadors. If you want the job, you’ve got to wrestle with the big problems, and that means that those of us who want to do something, [we have] to be willing to shake things up no matter who’s in charge.”

Antonio Olivo contributed to this report.