R. Creigh Deeds, a longtime state legislator from rural Bath County, won a stunning come-from-behind victory in the Democratic primary for Virginia governor last night, overwhelming a pair of better-funded and better-positioned opponents.

Deeds beat Brian Moran and Terry McAuliffe in every region of the state, including vote-rich Northern Virginia, despite a pro-gun stance and relatively conservative positions that are out of line with many of the area's voters. His victory was so dominant that he captured 10 of the state's 11 congressional districts, including the one held by Moran's brother, U.S. Rep. James P. Moran Jr.

All three campaigns and state political experts had agreed that Deeds was coming on strong in the final days of the race, but no one expected him -- or the other candidates -- to come close to winning the 50 percent of the vote that he captured. In an e-mail sent to supporters less than two hours before polls closed, McAuliffe's campaign predicted that "this thing could come down to the wire." McAuliffe came in second, with 26 percent of the vote, followed by Brian Moran with 24 percent.

Deeds, 51, will face Republican Robert F. McDonnell in a general election battle that amounts to a rematch of the race for attorney general four years ago, which McDonnell barely won after a late surge by Deeds.

This year, Deeds surged when he needed to, airing statewide TV ads in the final weeks of the race and capitalizing on an endorsement from this newspaper that quickly became a theme of his campaign in the Washington suburbs. As soon as it came out, he agreed to make a joint appearance with the other candidates in front of hundreds of business leaders, which he had previously turned down. He then added numerous other events in Northern Virginia and launched a week-long television blitz in the region.

Deeds, already known by Virginians in all corners of the state after his 2005 bid, began receiving the support of many undecided voters who were attracted to his pledge to bridge regional and partisan divides and invest in road and transit improvements.

Early in the race, it was Moran and McAuliffe who seemed to attract the most support. Many local Democratic leaders backed Moran, while McAuliffe assembled an all-star cast of Virginia campaign veterans. Both virtually ignored Deeds for months as polls repeatedly showed him in a distant third place.

But Deeds, a quiet, unpolished lawmaker who refused to attack or engage his rivals for much of the race, showed an authenticity that appeared to resonate with voters.

"He's intelligent. He's got a sense of Virginia history. He knows how to be effective, and he's dedicated to what's best for Virginia," said Peppy G. Linden, 59, executive director of the Children's Museum in Charlottesville. "He's not egotistical. And he works so damn hard."

At Deeds's victory party in Charlottesville, drinks were flowing, the sound system blared Fleetwood Mac's "Don't Stop Thinking About Tomorrow" -- the theme of Bill Clinton's first presidential campaign -- and the crowd chanted "Deeds, Not Words!" as Deeds and his wife, Pam, took the stage to deliver a victory speech whose opening was a bit understated.

"Well," he began, drawing laughs.

He told the crowd that the message that had carried him this far -- fixing the state's transportation woes, improving the quality of its schools and creating more jobs -- would carry him to victory in the fall against McDonnell.