NASHUA, N.H. — U.S. Sen. Bernie Sanders narrowly won the New Hampshire primary Tuesday, though his slight victory over Pete Buttigieg didn’t clarify the muddled field racing to challenge President Donald Trump.

If anything, the Democratic contest was shaken anew by U.S. Sen. Amy Klobuchar’s late surge to a third-place finish in the nation’s first primary, and more struggles from two candidates once seen as the race’s most formidable contenders.

Instead, U.S. Sen. Elizabeth Warren and former Vice President Joe Biden face questions about whether they have a path to victory, even as all five of the top finishers pledge to continue through votes this month in Nevada and South Carolina.

Sanders’ victory was his second in a row in the Granite State, and it came four years after his resounding victory over Hillary Clinton here helped lend credibility to his underdog bid for the presidency.

“It’s on to Nevada, it’s on to South Carolina, it’s on to win the Democratic nomination,” Sanders told supporters late Tuesday, “and together, I have no doubt we’ll defeat Donald Trump.”

But he faced an unexpectedly stiff challenge from Buttigieg, the former mayor of South Bend, Ind., who cut his margin of victory to just a few percentage points. As 1,200 supporters chanted “President Pete,” Buttigieg declared "we are here to stay.”

“And we will welcome new allies to the movement at every step,” he added.

Like Buttigieg, Klobuchar’s campaign also enjoyed growing crowds and suffocating media attention in the runup to Tuesday’s vote as both campaigned intensely for moderate voters.

“While there are still ballots left to count, we have beaten the odds every step of the way,” said Klobuchar, a Minnesota senator who promised to “take this message of unity to the country.”

Lagging far behind were Warren and Biden, who hovered in the single digits despite fervently competing in the state. Neither were expected to land any of the 24 delegates up for grabs.

Once poised to compete with Sanders for victory in her neighboring state, Warren appeared headed to a fourth-place finish. The Massachusetts senator used her campaign rally to denounce the “harsh tactics” of her primary opponents and urged her supporters to prepare for a drawn-out race.

“We might be headed for one of those long primary fights that lasts for months,” she said late Tuesday in Manchester, adding that “Americans in every part of the country are going to make their voices heard.”

It was the second gut punch in a row for Biden, who had embarked for South Carolina rather than stick around for returns that showed him headed for a fifth-place finish. He reminded a crowd in Columbia that more diverse states have yet to vote.

“That’s the opening bell, not the closing bell,” Biden told his supporters. “You cannot win the Democratic nomination for president, and you shouldn’t be able to win it, without black and brown supporters.”

Two other Democrats who struggled in the polls threw in the towel.

Andrew Yang suspended his campaign, which gained national attention for its promise to give every adult American a monthly $1,000 check. So did U.S. Sen. Michael Bennet of Colorado, who skipped Iowa to focus on New Hampshire.

More: New Hampshire primary results

Late breakers

If the stakes seem so much higher here, that’s because they are. For the first time since 2004, no candidate dropped out after Iowa’s catastrophic caucus, elevating the importance of New Hampshire and the two early-voting states that follow.

The president tried to further mix up the chaotic race, urging Republicans to vote for the “weakest candidate possible” in Tuesday’s race. More than 40% of the state’s voters are classified as independents, allowing them to cast ballots in either primary.

“My only problem is I’m trying to figure out who is their weakest candidate,” the president said at a Monday rally in Manchester. “I think they’re all weak.”

With the first-in-the-nation primary perch, New Hampshire voters have historically helped cull the field and, sometimes, shock the race by rendering surprising verdicts.

Bill Clinton was branded the “Comeback Kid” with a strong finish in the state in 1992 after an Iowa defeat. And Hillary Clinton won a narrow victory here in 2008 over Barack Obama. Eight years later, Granite State voters rebuked her and gave Sanders a dominating win.

Despite that history, the day started with the likelihood that none of the top candidates would drop out regardless of the outcome. Several announced stops in the larger states that vote March 3 as New Hampshire voters headed to the polls.

Waiting for them in those later states is self-funding billionaire Michael Bloomberg, and he’s already financed ads to clog the airwaves in expensive media markets across the nation, including in Georgia, which votes March 24.

Next stops

The biggest surprise of Tuesday came when Biden abruptly scrapped plans to stay in New Hampshire and bolted for South Carolina, where he’s long polled strongly with black voters who will dominate the state’s Feb. 29 primary.

“We’re pushing hard,” he told the owner of a Nashua restaurant Tuesday during an unannounced visit for lunch.

The pivot was abrupt: He had loaded his schedule over the weekend with stops across New Hampshire, where he questioned Buttigieg’s experience and stated that he’s "not a Barack Obama.” By Monday, Biden shifted back to attacks on Trump.

Rather than swiping back, Buttigieg was intent on making it a two-candidate race. At an election eve rally in Exeter, he said Sanders alienates most Americans with his talk of being “either for the revolution or you’re for the status quo.”

The Vermont senator, meanwhile, held a “primary night celebration” in Manchester and reveled in the high expectations leading to Tuesday’s vote. Confidently, he also sketched out plans to visit Super Tuesday states this week, starting with two stops Friday in North Carolina.

And Klobuchar attuned her closing message to winning over disgruntled Trump supporters and independent voters who see her as the best chance to unseat the president.

At a jam-packed rally at a middle school in Salem, she drew booming applause when she touted Utah U.S. Sen. Mitt Romney’s “courage and conviction” with his vote last week to convict Trump in his impeachment trial.

“We know the world is upside down,” she said, “when a Democratic rally is cheering for the former Republican nominee for president.”