(CNN) Hillary Clinton's razor-thin victory in the Iowa Democratic caucuses sets up a prolonged nomination fight with rival Bernie Sanders as the focus shifts to New Hampshire.

After an anxious night for both sides, the state Democratic Party declared Clinton the winner just before 1 p.m. Tuesday — and she immediately seized on her moment of triumph.

"I am so thrilled," Clinton told CNN's Wolf Blitzer in an interview minutes later. "My luck was not that good last time around, and it was wonderful to win the caucus, to have that experience."

But the slim margin of victory means Clinton failed to establish herself as the Democrats' clear standard-bearer in the first contest of 2016. While it once appeared that Clinton might wrap up the nomination quickly, the caucus results suggest the primary battle will be a hard-fought referendum on what the Democratic Party should be.

Clinton may need to to wait until late February for a realistic chance to put a solid win in her column. Sanders holds a strong lead in New Hampshire, the next state to vote on February 9.

Nevada holds its Democratic caucuses on February 20 and the South Carolina Democratic primary is a week later. Clinton could fare better with those more diverse electorates — the Iowa results showcased a Democratic Party with stark demographic fissures along class, race, age and ideological lines.

And the eventual winner will be tasked with bridging a party that could be much more split -- and damaged --than it was in 2008 after Clinton's battle with Obama.

The rivals will both take questions from New Hampshire voters during a CNN town hall Wednesday night.

Clinton's muddled Iowa showing will leave her supporters, donors and campaign staffers without bragging rights, possibly dampening enthusiasm and further ceding ground to Sanders.

She spoke at a rally in Nashua, New Hampshire, earlier Tuesday before the Iowa Democratic Party's announcement, sounding a confident note even as the race remained unresolved.

"I am so thrilled to be coming to New Hampshire after winning Iowa! I have won and I have lost there, it is a lot better to win," she told the crowd.

However, the Sanders campaign is moving to capitalize on a narrative resonating powerfully in an anti-establishment year: the little guy fighting the Democratic machine.

"We went toe-to-toe with the establishment," Sanders campaign manager Jeff Weaver told Blitzer on Tuesday. "We're extremely gratified."

New Hampshire may represent Sanders' best chance to buoy his campaign.

"We're going to fight really hard in New Hampshire and then we're going to Nevada, to South Carolina, we're doing well around the country," the Vermont senator said shortly after his campaign plane landed in the Granite State.

Greg Guma, who has watched Sanders' political career since the 1970s, predicted a protracted fight.

"This is a campaign that will go all the way to the convention," Guma, author of "The People's Republic: Vermont and the Sanders Revolution" said. "He will stay in this race even if she is mathematically winning. He will influence what is in the platform and what Clinton says at the convention."

In Iowa on Monday night, Clinton admitted breathing a "big sigh of relief" after escaping the state she handily lost to Obama in 2008. But she promised a vigorous campaign with Sanders.

"It's rare that we have the opportunity we do now," she said in a speech that didn't explicitly claim victory but sought to position her as the authentic and more pragmatic progressive in the race.

Sanders, who trailed Clinton in Iowa by 30 points three months ago, told a raucous crowd chanting "Bernie, Bernie" that his campaign made stunning progress.

"Nine months ago, we came to this beautiful state, we had no political organization, we had no money, we had no name recognition and we were taking on the most powerful political organization in the United States of America," he said.

Though Sanders fared well in Iowa and is nicely positioned in New Hampshire, his hurdle is proving that he can appeal to more ethnically diverse electorates in later contests in places such as South Carolina.

Sanders made the case to CNN's Chris Cuomo, when his campaign plane landed in New Hampshire early on Tuesday morning, that he expects to challenge Clinton among nonwhite voters.

"We lost (the nonwhite vote), but that gap is growing slimmer and slimmer between the secretary and myself. I think you'll find as we get to South Carolina and other states, that when the African-American community, the Latino community, looks at our record, looks at our agenda, we're going to get more and more support," Sanders told Cuomo on "New Day."

Thursday, Sanders and Clinton are set to participate in a New Hampshire town hall on CNN that will be moderated by Anderson Cooper--they won't appear on stage together. Even the scheduling of debates has started to devolve into a a sometimes petty and in-the weeds back-and- forth with each camp accusing the other of complicating the process.

"We have tried to be very accommodating. We have agreed to everything that they have asked us to do. And I sure hope, we are in Bernie Sanders' backyard here in NH, I sure hope he intends to show up in his neighboring state and let the people of New Hampshire see us both on the debate stage."

Sanders aides have said they won't agree to a debate in New Hampshire, unless Clinton agrees to a debate in New York.