New York Rangers right wing Rick Nash reacts after he...

New York Rangers right wing Rick Nash reacts after he scores a power-play goal against Calgary Flames goalie Brian Elliott in the first period of an NHL hockey game at Madison Square Garden on Sunday, Feb. 5, 2017. Credit: Kathleen Malone-Van Dyke

In a strange Sunday matinee that had everything from follies to fights, the Rangers somehow found some answers in the third period in their 4-3 victory over the Calgary Flames at the Garden.

After a second period that Rangers coach Alain Vigneault called “awful from both sides . . . there was nothing going on and no plays being made,” the Blueshirts beat goaltender Brian Elliott three times and held the Flames to two goals in the third period.

The Rangers had lost five of their last seven games at home. “We wanted to get a win in any fashion and start this [four-game] homestand off on the right foot,” captain Ryan McDonagh said.

Jesper Fast scored what proved to be the game-winning goal at 11:33 before the Flames made Henrik Lundqvist sweat by moving within 4-3 on Matthew Tkachuk’s score a minute later.

“We weren’t happy after the second. Too many mistakes,” said Fast, who struck for his fourth goal on a pass from J.T. Miller from the right post to the slot. Miller, who had forced a turnover, passed up a point-blank shot and found Fast in front, and Elliott had no chance. “Almost had an empty net,” Fast said.

Earlier in the period, Michael Grabner and Chris Kreider sandwiched goals around one by Calgary’s Troy Brouwer.

“They’ve been winning lately and have a lot of confidence,” said Lundqvist (29 saves), “but we came out in the third and it looked like we made up our mind that we wanted these two points.”

With the score 1-1 after 20 minutes, the Rangers never seemed to have the puck for more than a few seconds in the second, as the Flames stifled their offense and forced giveaways. The Blueshirts’ offense was choppy; nothing was smooth about their game. Their third shot of the period came with 5:45 left. It was up to Lundqvist to keep Calgary, which had far better scoring opportunities but only eight shots, at bay.

The transformation came suddenly in the third, engineered by two 20-goal scorers.

Grabner gave the Blueshirts a 2-1 lead with his 23rd goal of the season at 1:54. He initially missed a shot but retrieved the puck and got it to Miller, who fed Brady Skjei, and the rookie found Grabner in the lower right circle.

Kreider came down the left side, used defenseman Dennis Wideman as a screen and fired a shot over Elliott’s glove at 8:20 for his 21st goal to snap a 2-2 tie.

The teams traded power-play goals in the first. After Dan Girardi was whistled for a trip as he broke up a stretch pass at 5:26, a clearing pass up the middle by Lundqvist was intercepted, and Dougie Hamilton’s point shot went by a screen by Nick Holden at 6:59. The Blueshirts responded after Matt Stajan was sent off for tripping Mika Zibanejad just 44 seconds later. Elliott blocked Derek Stepan’s shot from the left side, but the rebound came to Rick Nash at the top of the crease and he snapped the puck over the goalie’s glove at 8:54 for his 15th goal.

A tenth of a second prevented the Rangers from taking a 2-1 lead in the first. A back-to-the-net deflection by Nash zipped under the crossbar but was overturned on review. The red light went on, but replays showed that time had run out.

“That’s what happens when things aren’t going in for you,” Nash said.

Fortunately for the Rangers, enough went right in the final 20 minutes.

“I thought we were the better team,” Flames forward Mikael Backlund said. “They came out hard in the third and took charge.”

More Rangers