Islanders right wing Tom Kuhnhackl celebrates his goal with teammates...

Islanders right wing Tom Kuhnhackl celebrates his goal with teammates Brock Nelson, Casey Cizikas, Nick Leddy and Ryan Pulock as Wild left wing Jordan Greenway skates away in the third period on Sunday in St. Paul, Minn. Credit: AP/Andy Clayton-King

ST. PAUL, Minn. — The Islanders needed this one badly.

Not just the two points, though those were extremely important. But they needed to feel they were playing the structured, solid defensive game that is their key to success.

“It was a big win,” said Leo Komarov, whose hustle play led to Matt Martin’s go-ahead goal. “We’ve been struggling lately. We tried to come out hard.”

The Islanders rallied for three goals in the third period in a 3-1 win over the Wild at Xcel Energy Center to snap a three-game losing streak. They had allowed 24 goals in a 1-3-1 skid.

“If we’re playing like tonight, a tight game, we know we’re going to win a lot of hockey games,” said goalie Semyon Varlamov, who made 25 saves.

The Islanders (24-10-3) regained second place in the Metropolitan Division heading into Tuesday afternoon’s game against the first-place Capitals, which will conclude this three-game road trip. They also avoided their first four-game winless streak since Barry Trotz became coach.

Devan Dubnyk also made 25 saves for the Wild (19-16-5), who are 10-3-3 at home and an NHL-best 13-5-4 since Nov. 14.

“We’ve been struggling the last week or two weeks,” said Martin, who made it 2-1 at 6:01 of the third period. He got to the crease and Komarov, falling to his backside heading into the right corner, fed it to him.

“We had some meetings and it’s just getting back to what we do best,” Martin added. “We just stuck with it tonight . . . We didn’t deviate from who we are as a team.”

Part of who the Islanders are — when successful — is a four-line team that gets balanced scoring. Getting goals from Martin and Tom Kuhnhackl, usually a bottom-six forward but on Mathew Barzal’s top line against the Wild as Trotz continues to search for the right line combinations, also was a positive sign.

“Throughout the game, good things are going to happen, bad things are going to happen,” said Kuhnhackl, who scored his first goal of the season from the slot to make it 3-1 at 17:29 of the third period after Casey Cizikas won an offensive-zone faceoff. “But you’ve got to stay positive and stick to your game plan. Today we did a pretty good job.”

The win came after Trotz conducted an up-tempo, back-to-basics practice Saturday at the University of Minnesota’s Ridder Arena that focused almost exclusively on defensive zone work.

“They know the right way to play and how hard it is to win in this league and how much you have to commit,” Trotz said. “We can’t have any passengers. We can’t have any guys on their own page. I think yesterday was a good practice to get back on the same page.”

With Barzal and Derick Brassard buzzing the crease and Dubnyk believing the whistle should have been blown, Ryan Pulock’s wrist shot from just inside the blue line got through traffic to tie it at 1 at 4:24 of the third period.

The Islanders took the game’s first five shots and tried to establish a physical presence quickly. But Dubnyk stopped all 10 shots he faced in the first period and the Wild led 1-0.

More Islanders