MANCHESTER, N.H. — Bernie Sanders won New Hampshire's presidential primary election Tuesday night, narrowly edging moderate rival Pete Buttigieg and scoring the first clear victory in the Democratic Party's chaotic 2020 nomination fight.

In his win, the 78-year-old Sanders, a self-described democratic socialist, beat back a strong challenger from the 38-year-old former Midwestern mayor -- two men representing different generations and wings of their party.

"This victory here is the beginning of the end for Donald Trump," Sanders declared.

As Sanders and Buttigieg celebrated, an unexpectedly strong performance from Amy Klobuchar gave her a path out of New Hampshire as the contest moves on to the string of state-by-state primary contests that lie ahead. Joe Biden and Elizabeth Warren posted disappointing results and were on track to finish with zero delegates from the state.

The New Hampshire vote made clear that the early days of the Democratic contest will be a battle largely between two men four decades apart in age and ideological opposites. Sanders is a leading progressive voice, calling for substantial government intervention in health care and other sectors of the economy. Buttigieg has pressed for more incremental changes, giving Americans the option of retaining their private health insurance and making a point of appealing to Republicans and independents who may be dissatisfied with Trump.

"Thanks to you, a campaign that some said shouldn't be here at all has shown that we are here to stay," Buttigieg told cheering supporters.

Yet Sanders and Buttigieg enter the next phase of the campaign in different political positions.

While Warren made clear she will remain in the race, Sanders, well-financed and with an ardent army of supporters, is quickly becoming the leader of the progressive wing of the party.

Meanwhile, Buttigieg still has moderate rivals to contend with, including Klobuchar, whose standout debate performance led to a late surge in New Hampshire. Biden promises strength in upcoming South Carolina, while former New York Mayor Mike Bloomberg was not on Tuesday's ballot but looms next month.

After a chaotic beginning to primary voting last week in Iowa, Democrats hoped New Hampshire would provide clarity in their urgent quest to pick someone to take on Trump in November. At least two candidates dropped out in the wake of weak finishes Tuesday night: just-the-facts moderate Colorado Sen. Michael Bennet and political newcomer Andrew Yang, who attracted a small but loyal following over the past year and was one of just three candidates of color left in the race.

While struggling candidates sought to minimize the latest results, history suggests that the first-in-the-nation primary will have enormous influence shaping the 2020 race. In the modern era, no Democrat has ever become the party's general election nominee without finishing first or second in New Hampshire.

The action was on the Democratic side, but Trump easily won New Hampshire's Republican primary. He was facing token opposition from former Massachusetts Gov. Bill Weld.