RICHMOND, Va. — A state senator and small-town lawyer pulled off a surprising win in Virginia's Democratic primary for governor, besting a former legislative colleague and the well-funded Terry McAuliffe, the former chairman of the Democratic National Committee.

Tuesday's victory by Democrat Creigh Deeds sets up a rematch this fall with Republican Bob McDonnell.

Deeds lost to McDonnell in the race for attorney general four years ago by only 323 votes out of almost 2 million cast — the closest race in modern Virginia history.

But in an Associated Press interview, Deeds said he doesn't consider the fall election a grudge match.

"The rematch isn't so important to me," Deeds said of facing McDonnell, a conservative with strong ties to Pat Robertson.

Deeds won nearly 50 percent of the vote Tuesday. He and his erstwhile Democratic rivals, McAuliffe and Brian J. Moran, hope to put the past behind them starting Wednesday with an appearance together in Richmond with current Gov. Timothy M. Kaine, who is barred from serving consecutive terms by the state constitution.

Kaine is also chairman of the DNC, the same job once held by McAuliffe, a former White House confidante of President Bill Clinton.

Emotional victoryDeeds was choked with emotion in front of supporters in Charlottesville Tuesday night as he recalled growing up in a family of modest means in the small Alleghany Mountain community of Bath County. He repeated his often-told tale of how his mother sent him off to college with only $80 to spend.

"Only in the commonwealth of Virginia, can a mother who still works as a mail carrier in Bath County send his son off to college with four $20 bills in his pocket — that was all — and have her son be standing before you as the Democratic nominee to be the next governor," Deeds said.

Nearly 320,000 people voted in the race, only 6 percent of the state's 5 million registered voters but more than officials predicted. Deeds piled up surprisingly large margins across the state, including in the Washington suburbs of northern Virginia that his opponents call home.

Deeds raised only about $3.7 million, far less than his rivals. McAuliffe, who dominated fundraising, received nearly twice Deeds' total. Deeds' staff was so sparse he often drove himself to campaign events, and he had to lay off field staffers at one point so he could afford to run television ads in the final two weeks of the campaign.

McAuliffe and Moran had criticized Deeds for legislative votes supporting Virginia's broad pro-gun laws, actions popular in rural areas that don't play well in cities and affluent suburbs.

McAuliffe's cash and coverageMcAuliffe's political connections from his days as chief fundraiser for Clinton and chairman of the DNC helped him dominate press coverage and amass a hefty amount of cash in his first bid for elective office.

The indefatigable McAuliffe, who had campaigned statewide with the former president, told dejected backers the campaign was "one of the greatest experiences of my life." He received polite applause when he exhorted them to help elect Deeds in November.

McAuliffe barged into the race in January, saying the experience as a businessman and investor that made him wealthy would help him create new jobs in Virginia.

Moran, a former House Democratic Caucus leader from Alexandria, went further to the left than his rivals in appealing to liberal activists. He pledged to oppose new coal-fired power initiatives and reverse the state's same-sex marriage ban.

Deeds hewed toward the middle politically and stayed out of the crossfire between Moran and McAuliffe for much of the campaign. Because he remained in the Senate, he missed 46 days at the start of the campaign and was barred by state law from raising money during that time.

After Deeds surged in polling near the end of the campaign, his opponents attacked him for Senate votes against closing a loophole in state laws that exempt gun show sales from background checks. Federally licensed gun retailers must perform the checks.

Copyright 2009 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.