(CNN) - Terry McAuliffe, a former Democratic National Committee chairman, will beat Republican state Attorney General Ken Cuccinelli Tuesday to become Virginia's next governor, CNN projects, ending a race that largely focused on national issues and saw heated attacks between the two candidates.
In his victory speech, McAuliffe painted his win as a point for bipartisanship.
"This election was never a choice between Democrats and Republicans, it was a choice about whether Virginia would continue the mainstream, bipartisan tradition that has served us so well over the last decade," he said, offering praise to both the incumbent Republican governor and his Republican rival.
Of the two gubernatorial races this year, the contest in Virginia was by far the closest, and Tuesday night ended in a narrow victory for McAuliffe.
"I always said it was going to be close," McAuliffe told CNN's Dana Bash. "I always said it was going to be a couple of points from the day I got in."
"We knew it was going to be tough," he added. "(We had a) great field team, great volunteers– spectacular. It's a great win. We're happy and now we got a lot of work to do."
For months McAuliffe held a small, consistent lead in public opinion polls over Cuccinelli, who was considered a hero by many tea party supporters and other grass-roots activists, thanks to his very public conservative crusades, including his push against Obamacare.
A third-party candidate, libertarian Robert Sarvis, was thought to be a potential spoiler. Sarvis was taking around 8% to 10% of the vote in recent polls, a significant chunk with the race between the Republican and Democratic candidates so close.
McAuliffe will succeed Republican Gov. Bob McDonnell, who didn't run for re-election because Virginia governors cannot serve consecutive terms.
The main two campaigns engaged in nasty political warfare that took over the airwaves in Virginia. McAuliffe made sure women were aware of Cuccinelli's support of "personhood" legislation that critics say restricts abortion and some forms of birth control.
Cuccinelli has frequently highlighted federal investigations of an electric car company that McAuliffe co-founded.
Both sides also attempted to frame the race as a referendum on larger national issues. Cuccinelli's supporters argued a vote against McAuliffe was a vote against Obamacare.
"We said this race was a referendum on Obamacare, and although I lost, tonight you sent a message to the president of the United States...that Obamacare is a failure and that you want to be in charge of your health care– not the government," Cuccinelli said in his speech Tuesday night.
McAuliffe and Democrats pinned Cuccinelli as a tea party activist, linking him to conservative lawmakers in Washington who initiated a strategy that eventually led to last month's government shutdown.
Although McAuliffe came out on top, neither candidate was particularly well-liked. A Quinnipiac Poll released Monday showed 42% of likely voters had a favorable opinion of the Democrat, while 45% had an unfavorable view. Cuccinelli also had a negative favorability rating, 38% to 52%.
Cuccinelli particularly struggled to gain support among women and to unite the commonwealth's GOP base.
High-profile surrogates came out to bat for the two main gubernatorial hopefuls in the last weeks of the campaign. President Barack Obama, former President Bill Clinton, former Secretary of State Hillary Clinton and Vice President Joe Biden all hit the trail for McAuliffe.
Cuccinelli, meanwhile, had support from GOP Gov. Bobby Jindal of Louisiana, Sen. Rand Paul of Kentucky and former GOP presidential candidate Mike Huckabee of Arkansas. Former Rep. Ron Paul also endorsed the attorney general and headlined an event for Cuccinelli on Monday night.
With McAuliffe's win, he breaks a long streak in Virginia gubernatorial contests. In the last nine elections, the party controlling the White House lost the governor's race.
When McAuliffe is sworn in, Republicans will control 29 of the nation's governorships, down from 30 before his victory.