Bernie Sanders Projected to Win New Hampshire Democratic Primary This projection is based on exit poll data and vote analysis.

 -- ABC News projects Vermont Senator Bernie Sanders will win the New Hampshire Democratic primary, based on exit poll data and vote analysis.

Sanders, a self-proclaimed democratic socialist, led former Secretary of State Hillary Clinton in recent polls in the Granite State. Following a close race in Iowa between the two contenders for the Democratic presidential nomination, which Clinton barely won, both campaigns ramped up their attacks in New Hampshire.

Sanders thanked his supporters in a tweet posted just after the polls closed at 8 p.m. EST and went on to celebrate his win by playing basketball with all of his grandchildren in a basement gym below his victory party in Concord, New Hampshire.

An hour later, Sanders took to the stage and thanked a cheering crowd. "Together we have sent a message that will echo from Wall Street to Washington, from Maine to California," Sanders said. "And that is that the government of our great country belongs to all of the people and not just a handful of wealthy campaign contributors and their super PACs."

In her own tweet, Clinton congratulated Sanders and expressed gratitude to New Hampshire voters.

Clinton addressed her supporters in Hooksett, New Hampshire. “I want to say, I still love New Hampshire,” Clinton said. “Here’s what we’re going to do. Now we take this campaign to the entire country. We’re going to fight for every vote in every state. We’re going to fight for real solutions that make a real difference in people’s lives."

Earlier in the evening, Clinton campaign manager Robby Mook conceded defeat in a memo.

“After splitting the first two contests, an outcome we’ve long anticipated, attention will inevitably focus on the next two of the ‘early four’ states: Nevada and South Carolina,” Mook wrote. “We’ve built first-rate organizations in each state and we feel very good about our prospects for success.”

Mook then looked ahead to the states that will vote in March, which as he put it, "better reflect the true diversity of the Democratic Party and the nation."

"The nomination will very likely be won in March, not February," he wrote, "and we believe that Hillary Clinton is well positioned to build a strong – potentially insurmountable – delegate lead next month."

The Sanders campaign invested heavily in the Granite State and aggressively advertised on televisions from the north to the suburban Boston enclaves in southern New Hampshire.

In a state that values retail politics, both Clinton and Sanders spent time knocking on doors and greeting patrons at local coffee shops in the days leading up to the primary. But no matter how many selfies Clinton took or country roads she crisscrossed, she was unable to catch the Vermont senator.

According to preliminary exit polls, Democratic primary voters ranked “honesty” and “trustworthiness” as the most important candidate attributes. Far more voters polled recognized those values in Sanders than Clinton.

In New Hampshire, Clinton was on the defensive.

The Sanders campaign pressed Clinton on her Wall Street connections, calling into question her ability to separate corporate from public interests. Out on the trail, Sanders presented himself as an underdog who is not beholden to pressures from big banks.

In an interview on “This Week with George Stephanopoulos” on Sunday, Clinton directly addressed attacks by Sanders. “I have never, ever been influenced in a view or a vote by anyone who has given me any kind of funding,” Clinton said.

Both Clinton and Sanders went after undecided voters in New Hampshire, a state known for its independent streak (voters without party affiliations are welcome to vote in either the Democratic or Republican primary). But it was the Sanders campaign that was able to win over voters under the age of 30 by a huge margin.

During her first presidential campaign in 2008, Clinton was able to successfully win the New Hampshire primary against another candidate with widespread support among young people – then Senator Barack Obama.

Get real-time updates as this story unfolds. To start, just "star" this story in ABC News' phone app. Download ABC News for iPhone here or ABC News for Android here.