MANCHESTER, N.H. — Facing a two-goal deficit while riding an eight-game losing streak, the Maine men’s hockey team never let doubt creep into the picture.

The Black Bears could sense that an explosion of goals was a matter of time, center Devin Shore said, and that time was Friday. Maine turned its fortunes emphatically, scoring five unanswered goals to subdue its fiercest rival, New Hampshire, 5-2, before an announced crowd of 5,028 at Verizon Wireless Arena.

It started with Blaine Byron’s team-leading sixth goal, on a rebound off of a Ben Hutton shot, at 9:04 of the second period. That cut the Wildcats’ lead to 2-1, and set the table for the feast to come.

“Once you get that first one, you know it’s not going to be one of those nights,” said Shore, whose team had mustered only 14 goals in its longest skid since 1985-86. “Sometimes there’s those nights where you’re doing everything but scoring. And we just keep going and we never looked back.”

Shore’s slapshot from the top of the right circle on the power play was deflected into the net by Nolan Vesey at 11:25 to tie the score 2-2. It was one of three assists that the captain recorded.

Freshman Malcolm Hayes followed with the game-winner, deftly moving the puck to his backhand in traffic out front and swiping it past goaltender Adam Clark at 17:01 of the second.

“I just happened to be in front at the right time,” Hayes said. “I just really tried to get it on net, just try to create some havoc. That’s what (Coach Red Gendron) puts that line out there for, just to be a problem in front. And I thought we did a good job of that. We just kept attacking them, grinding them down.”

Maine (4-12-1) took that one-goal lead into the third period, which hasn’t always been a recipe for victory this season. The Black Bears had just watched UMass-Lowell erase a third-period deficit and win 3-2 in overtime last Saturday.

This time, the Black Bears kept the pressure on. Will Merchant and Hutton (on the power play) added goals to provide the final cushion and an abundance of postgame smiles that hadn’t been seen since a 3-2 win over UMass on Nov. 1.

The difference, Shore said, was that instead of looking up at the clock and wishing for it to count down quickly, Maine could look up at the scoreboard and see its highest goal total since a 6-5 OT victory over UMass on Oct. 31.

“In past third periods, we’ve been kind of trying to hang on to the lead, looking up at the clock, playing almost afraid to lose. This time we just wanted to finish the job,” he said. “We didn’t just sit back and try to defend goals. We went out and got more goals.”

It was a mindset that Gendron was pleased to see.

“In sports, it’s not about what you know cognitively, it’s about what you do,” Gendron said. “So you can say you’re going to keep attacking and whatnot and then not do it. Today, we continued to attack in the third period. We were able to add to the lead. So the difference between understanding something and actually doing it, that’s what learning means in hockey, when you do it in the heat of battle.”

The heat will be there again at 7 p.m. Saturday when the teams meet for a 119th time, this one at a soldout Cross Insurance Arena in downtown Portland. New Hampshire (4-10-1) will be looking to get revenge and end a five-game winless string of its own.

This weekend series doesn’t count in the Hockey East standings. When the teams meet again for a more traditional home-and-home series Jan. 23-24, there will be conference implications.

Gendron will be looking for another complete game from his team before taking a three-week hiatus.

“The credit for this victory goes to all the players who wore blue tonight,” he said. “There wasn’t any brilliant coaching maneuver, I can assure you. But there were weeks of hard work that the players put in where they earned the right to have a chance to win. That’s all.”