MANCHESTER, N.H. — For the second time, Sen. Bernard Sanders won New Hampshire’s first-in-the-nation primary, strengthening his grip on the far-left mantle in the race and giving him a burst of momentum heading into this month’s Nevada caucuses and South Carolina primary.

The networks race was called for Mr. Sanders three hours after the last polls closed at 8 p.m., giving him bragging rights to back-to-back New Hampshire wins in 2016 and 2020.

With 86% of the vote counted, the self-described socialist was leading with 26.1 % of the vote, followed by Mr. Buttigieig, 24.3%, and Sen. Amy Klobuchar, 19.8%.

Sen. Elizabeth Warren and former Vice President Joseph R. Biden appeared headed for disappointing fourth and fifth place finishes, and were projected to lose out on winning any of the state’s 24 delegates.

Mr. Sanders, a senator from neighboring Vermont, rode a wave of support from young and very liberal voters to victory after falling just shy of capturing the top spot in the Iowa caucuses last week.

It was another noteworthy achievement for the 78-year-old, whose campaign appeared to be in trouble when he suffered a heart attack on the trail just four months ago. Since then, though, he easily raised more money than his rivals, steadily rose in the polls and proved on Tuesday that his better-than-expected showing in the nomination race four years ago wasn’t a fluke.

The race here in many ways was for supremacy in the center-left lane between Mr. Buttigieg and Ms. Klobuchar.