NASHUA, N.H., 1 a.m. — In a stunning reversal of fortunes, New York Senator Hillary Clinton LAW ’73 overcame Illinois Senator Barack Obama to win the New Hampshire primary on Tuesday, re-establishing herself at the top of the Democratic field and dealing a devastating blow to Obama’s surging campaign.

The only suspense heading into Tuesday appeared to be whether or not Obama would win New Hampshire by double digits. Rumors abounded that Clinton might be preparing to shake up her senior staff. And the Drudge Report even floated the idea that Clinton might drop out of the race following the primary in order to save face.

But by 11 p.m., it was clear that Clinton had pulled off as unexpected a political comeback as any in recent memory. Left for dead by pundits and pollsters and reduced to tears only a day ago, Clinton supporters turned out en masse and propelled her to victory.

Suddenly, the longtime frontrunner is back in front. And while the thousand Obama supporters who waited for hours in a high school gymnasium here in the expectation of celebrating a decisive victory still cheered on their candidate with eat-shattering enthusiasm, at the end of the night, they were left in a state of shock, uncertain about what had gone so wrong, so quickly.

“Over the last week, I listened to you, and in the process I found my own voice,” Clinton said during her victory speech, The Associated Press reported. “Now, together, let’s give America the kind of comeback that New Hampshire has just given me.”

With 87 percent of precincts reporting, Clinton topped Obama by three points, 39 percent to 37 percent, according to The Associated Press. Former vice presidential candidate John Edwards finished a distant third with 17 percent of the vote, followed by New Mexico Governor Bill Richardson at 5 percent.

Among the Republicans, Arizona Senator John McCain emerged with a five-point win over former Massachusetts Governor Mitt Romney. Former Arkansas Governor Mike Huckabee finished third, which he called a victory in itself, and former New York City Mayor Rudy Giuliani finished fourth.

But that much was expected. For the Democrats, though, Obama was thought to be completely in command, with polls giving him the lead in New Hampshire by as much as 13 points following his decisive win over Clinton last Thursday in Iowa.

But those polls were proven wrong, and Hillary now becomes the second Clinton who can claim to be “the Comeback Kid.” Her husband, former President Bill Clinton LAW ’73, used a surprise second-place finish in New Hampshire in 1992 to launch his improbable run to the White House.

As precinct after precinct around the Granite State reported their results Tuesday night, Clinton guarded a roughly three-point lead over Obama, although aides for the Illinois senator hoped that several college towns that did not immediately report results — including Hanover, the home of Dartmouth College, and Durham, the home of the University of New Hampshire — would propel Obama to victory.

In Hanover, Obama led a rally before hundreds of students at Dartmouth College this morning. As the rally ended, Obama volunteers led students directly from the rally to a nearby high school so they could vote. Among those volunteers was at least one Yale student, one of a handful who trekked to New Hampshire over the last week to help knock on doors, telephone voters and put in legwork to help deliver the election for their candidate.

Around the Dartmouth campus, Obama volunteers stood on street corners passing out maps to help students find where to vote, and volunteers drove vans back and forth to the high school from various spots around campus in order to make it even easier for students to vote.

And it seemed like it worked. Scores of students streamed in and out of the polling place at Hanover High School throughout the day, and many wore stickers indicating they had voted for Obama. Students said the Illinois senator far and away commanded the most support among students of any candidate.

The town of Hanover did overwhelmingly support Obama, giving him 58 percent of the vote compared to Clinton’s 26 percent.

But it was not enough.

At 10:34 p.m., The A.P. projected that Clinton would hold her lead, and Obama entered a local high school gymnasium here just a few minutes later to concede the race and congratulate Clinton on a “hard-fought” victory.

In an effort to project strength despite the surprising defeat, the thousands of supporters who had gathered here screamed, clapped and chanted louder than ever during Obama’s speech. But a sense of shock nonetheless reverberated throughout the room.

A few minutes later, Clinton stood before her supporters at Southern New Hampshire University in Manchester, vowing to turn this victory into many others to come.

“I come tonight with a very, very full heart and I want especially to thank New Hampshire,” she said. “For all the ups and down of this campaign, you helped remind everyone that politics isn’t a game. … We came back tonight because you spoke loudly and clearly.”

“Tomorrow, we’re going to get up, roll up our sleeves and keep going,” Clinton said to enthusiastic applause.

Despite the loss, Obama vowed to fight on, undaunted.

“A few weeks ago, no one imagined that we could accomplished what we did here tonight in New Hampshire,” he said, drawing wild screams from the capacity crowd.

“But in record numbers, you came out, and you spoke up for change,” Obama said. “You made it clear that in this moment and this election there is something happening in America. … We are ready to take this country in a fundamentally new direction.”

The rally ended, as most of Obama’s do, with the loudspeakers blaring Stevie Wonder’s “Signed, Sealed, Delivered.”

An Obama victory in New Hampshire was supposed to be exactly that.

—Thomas Kaplan