MANCHESTER, New Hampshire (CNN) -- Sens. Hillary Clinton and John McCain received much-needed boosts from New Hampshire Tuesday.
Clinton, coming off a disappointing third-place finish in Iowa, rebounded to overcome rival Sen. Barack Obama in the state's Democratic primary.
Supporters at her headquarters chanted "comeback kid" as the results came in.
Clinton trailed Obama by 9 points in recent polls.
On the Republican side, McCain easily won his party's primary.
The results mark a resurgence for the Arizona senator, whose campaign was all but written off this summer. What do the results mean? »
Clinton and McCain embraced their comeback positions in addressing supporters Tuesday night.
"Over the last week, I listened to you, and in the process I found my own voice," Clinton said to a crowd of young supporters. Watch Clinton thank New Hampshire »
"Now together, let's give America the kind of comeback that New Hampshire has just given me."
McCain, a 71-year-old, four-term senator, was met by a crowd shouting, "Mac is back." Watch McCain celebrate his win »
"I'm past the age when I can claim the noun 'kid,' no matter what adjective precedes it, but we sure showed them what a comeback looks like," he said.
McCain pinned his win on "one strategy" -- telling the people of New Hampshire what he believes. Watch a slideshow of the candidates' speeches »
"When the pundits declared us finished, I told them, 'I'm going to New Hampshire, where the voters don't let you make their decisions for them,' " he said. " 'I'm going to New Hampshire, and I'm going to tell people the truth.' "
Female voters and older voters helped hand Clinton the Democratic win, according to exit polls.
In Iowa, Clinton lost out to Obama among women 35 percent to 30 percent. In New Hampshire, however, 45 percent of female Democratic primary voters picked Clinton, compared to 36 percent who went for Obama.
Older voters also overwhelmingly outnumbered younger voters, a proportion that benefited Clinton. Sixty-seven percent of Democratic primary voters were over the age of 40, and they were breaking heavily for Clinton over Obama.
McCain overcame former Massachusetts Gov. Mitt Romney to seal the win in New Hampshire with 37 percent of the vote.
Romney had led most polls in Iowa and New Hampshire before the votes there and held a 12-point lead in New Hampshire shortly before Christmas. He finished second, as he did in Iowa, five points behind McCain.
Romney won Saturday's Wyoming caucus.
Former Arkansas Gov. Mike Huckabee -- winner of the Iowa caucuses -- finished third with 11 percent.
Voters who supported McCain and those who supported Romney differed significantly on what issues they feel are most important, exit polling showed.
Forty-six percent of those who supported McCain ranked the war in Iraq the most important. Meanwhile, voters who supported Romney overwhelmingly felt immigration was the most important issue.
McCain has been a staunch supporter of the war in Iraq, but co-sponsored failed immigration reform legislation that drew the ire of many conservatives in his party. Romney has been taking a tough stance on immigration.
McCain bested Huckabee, a one-time Baptist minister, among New Hampshire voters who said a candidate's religious beliefs matter a great deal, according to CNN exit polls. While Huckabee won overwhelmingly among those voters in Iowa, in New Hampshire, 35 percent went to McCain while 31 percent went to Huckabee.
The religious voters made up 14 percent of all Republican primary voters in New Hampshire -- much less than in Iowa.
Huckabee and Romney called McCain to congratulate him Tuesday night.
"I'll fight to be back in this state and others," Romney told supporters. Watch Romney congratulate McCain »
Huckabee, who earlier said a third-place finish would be "huge" for him, also promised to return to New Hampshire.
"After we secure the nomination, we've got to come back here and make sure we carry New Hampshire."
Obama, the junior senator from Illinois, congratulated Clinton and praised "all the candidates in this race" as "patriots who serve this country honorably."
But Obama assailed critics who he said doubted his campaign and said the record numbers of voters in Iowa and New Hampshire showed "there is something happening in America."
"For most of this campaign, we were far behind," he said. "We always knew our climb would be steep. But in record numbers, you came out and you spoke up for change."
Former Sen. John Edwards of North Carolina painted himself as the candidate of the voiceless after tracking a distant third in the Democratic primary.
Noting that there are "two states down, 48 states to go" in primary and caucus voting, the 2004 vice presidential nominee said that only about 1 percent of Americans had voted so far and that the other "99 percent deserve to be heard." Watch Edwards describe where he goes next »
With 95 percent of precincts counted, Clinton had 39 percent of the vote to Iowa caucus winner Obama's 37 percent. Edwards had 17 percent. New Mexico Gov. Bill Richardson had 5 percent, and Ohio Rep. Dennis Kucinich had 1 percent.
With 95 percent of Republican precincts reporting, former New York Mayor Rudy Giuliani had 9 percent and Texas Rep. Ron Paul had 8 percent. Former Tennessee Sen. Fred Thompson received 1 percent of the vote. Watch Paul say he will continue to fight »
New Hampshire Gov. John Lynch predicted a record turnout for the first-in-the-nation presidential primary. He said he expected half a million people to vote.
The Democratic race now will focus on upcoming contests in Nevada and South Carolina, and could easily stretch past "Super Tuesday" on February 5.
The next GOP contest with delegates at stake is on January 15 in Michigan, where Romney's father was governor in the 1960s. E-mail to a friend
CNN's Bill Schneider, Paul Steinhauser and Anastasia Diakides contributed to this report.