Matthew Diebel

USA TODAY

Ohio Governor John Kasich, who has staked much of his presidential campaign on his performance in New Hampshire, got some early good news in the Granite State primary, staying neck-and-neck with the heavy favorite, Donald Trump, as the pair, along with Ted Cruz, led the rest of the field in the three small towns that vote just after midnight.

In the tiny town of Dixville Notch, situated about 20 miles from Canada, Kasich sneaked past Trump, 3-2.

Meanwhile, in Hart’s Location, about 80 miles south of Dixville, Kasich bested Trump again, 5 votes to 4, with Chris Christie gathering 2 votes and Jeb Bush, Ben Carson and Marco Rubio with one vote each.

What you need to know about the New Hampshire primary

But in Millsfield, just south of Dixville Notch, Ted Cruz won handily with 9 votes, according to the New Hampshire Union Leader newspaper, followed by Trump with 3 and Bush, Christie, Kasich, Rubio, former CEO Carly Fiorina, and Kentucky Sen. Rand Paul -- who suspended his campaign after Iowa -- with 1 vote each.

In the Democratic race, the three towns as a group were solidly behind Sen. Bernie Sanders.

In Dixville, it was a walkaway win for Sanders, who garnered four votes to Hillary Clinton’s zero.

And in Hart’s Location, the Vermont legislator got 12 nods, followed by Clinton with seven and Mark Stewart Greenstein, a self-described “liberty-leaning Democrat,” with two.

But there was good news for Clinton in Millsfield, where she edged Sanders two votes to one.

USA TODAY's 2016 Presidential Poll Tracker

Under New Hampshire state law, communities with fewer than 100 voters can get permission to open their polls at midnight and close them as soon as all registered voters have cast their ballots. Dixville exists as a town only for voting purposes. Almost all of its nine voters are employees of a resort hotel there, which closed in 2011 but is currently undergoing a major overhaul under new owners.

Les Otten, a former ski industry executive who is leading the redevelopment of the hotel, The Balsams, and also is living onsite full-time, told the Union Leader he voted for Kasich, even though he is friends with the Bush family. Otten told the paper that Kasich is a sensible candidate who's been able to keep above the fray during the furious campaign.

Game on: What each candidate needs from New Hampshire

Appearing on MSNBC’s Morning Joe show early Tuesday morning, Kasich said he is "calm" about his prospects.

"I can't explain it other than we've done everything we need to do here and it's in the hands of the voters," he told the show’s hosts.

The Associated Press contributed to this report.