RELATED LINK: Get live election results HERE
Unofficial results showed McDonnell, a conservative and former state attorney general, with more than 60 percent of the vote over Democrat R. Creigh Deeds. He will be the state's first Republican governor in eight years.
"I just got tackled by my five kids and my wife, and there are a lot of tears on my cheeks right now," McDonnell told The Associated Press.
When the TV screens at his headquarters flashed that he had won the election, his supporters in a crowded Richmond hotel ballroom screamed, waved signs and began chanting, "Go, Bob, go!"
A few miles away at a hotel where Deeds supporters gathered, the atmosphere was quiet until the defeated Democratic candidates emerged shortly before 9 p.m. to make their concession speeches. Then the cheering began there, too.
The race, along with the contest for governor of New Jersey, was viewed as the first referendum on the president and the Democratic Congress before the 2010 midterm elections.
"I hope this will kind of send a message to Congress that you better do what we want or we won't re-elect you," said Linda Doland, 60, a nanny in suburban Richmond who voted for McDonnell.
Ali Ganyuma, 39, a physical therapist in Richmond, hoped his vote for Deeds also would send a message to Washington.
"The biggest reason why I voted for Creigh Deeds was in the national politics, not local politics, because the right wing might take these as an ultimatum, a verdict on Obama's administration," he said.
A year ago, Obama became the first Democrat in 44 years to carry Virginia in a presidential race.
This time voters expressed angst about major Obama initiatives such as health care, energy and stimulus spending. But McDonnell dominated the campaign's central issues: jobs and the economy.
In Associated Press surveys at polling places statewide, about eight in 10 voters said they were worried about the direction of the nation's economy, and the majority of those favored McDonnell.
McDonnell, 55, never trailed in polls, even though his lead narrowed in September after news reports of a graduate thesis he wrote in 1989 that disparaged working women, gays and unmarried "cohabitators." He dismissed it as a forgotten academic exercise and said raising three daughters had changed his views.
McDonnell will succeed Gov. Timothy M. Kaine, chairman of the Democratic National Committee, who is barred by state law from seeking a second term. Kaine directed $6 million in DNC money into Virginia for Deeds and other Democratic candidates.
Deeds, a moderate country lawyer and state senator, never energized the party's liberal activists despite campaigning twice with Obama, who last year powered a political tsunami that swept three of Virginia's 11 U.S. House seats from the GOP. It also put both U.S. Senate seats in Democratic hands for the first time since 1970.
Republicans were in disarray after the 2008 loss, but took advantage of public unease over major Obama initiatives on health care, energy and stimulus spending legislation.
Exit polls showed nearly a third of voters in Virginia during the day described themselves as independents and they preferred McDonnell to Deeds by almost a 2-1 margin.
It was a reversal of a year ago when independents in the pivotal swing state and across the country tilted heavily toward the Democrats, fueling Obama's White House victory.
In another troubling omen for Democrats, the surveys also showed more supporters of Republican John McCain turned out than those who had voted for Obama a year ago. That suggests Democrats had difficulty getting out their base, including minority and youth voters who swarmed to the president in 2008.
Voters were split on Obama's job performance. While many said the president was not a factor in their votes for governor, about a quarter said their vote for McDonnell was also a rejection of Obama.
The exit poll of 2,053 Virginia voters was conducted for AP by Edison Research in a random sample of 40 precincts statewide. Results were subject to sampling error of plus or minus 3 percentage points, higher for subgroups.
In other Virginia races, Republican Lt. Gov. Bill Bolling won re-election over Democrat Jody Wagner, and ticketmate Kenneth Cuccinelli was elected attorney general over Democrat Steve Shannon with about the same share of the vote as McDonnell. All 100 seats in the House of Delegates were up for election, with contested races for 69 seats.