The agonizing dry spell is over.

With a desperate, gutsy effort, the Rangers finally won a home playoff game Tuesday night and tied their Stanley Cup playoff series with the Montreal Canadiens at two games apiece with a 2-1 victory.

After losing their past six postseason games at the Garden, the Blueshirts rebounded from a mystifyingly lethargic performance on Sunday and edged the Canadiens on goals by Rick Nash and Jesper Fast and 23 saves from Henrik Lundqvist.

“We came back after a tough loss,” said Nash, who had eight shot attempts and the game-winner on a drive to the net at 4:28 of the second period that snapped a 1-1 tie. “It was a bad couple days around here. I was trying to go to the net all night and trying to cause some chaos. We let it all go and put it behind us. We had to. We couldn’t be going back to Montreal down 3-1.”

Ryan McDonagh’s keep-in at the left point led to the goal. He found Nash to the right of Carey Price (30 saves) and the veteran winger, who had been called for goaltender interference earlier, took the puck to the crease again and slid a backhander under Price’s left pad.

“He was a beast out there, it was kind of man among boys sometimes,” defenseman Brady Skjei said of Nash. “He’s an experienced guy and made the right play when it was there.”

advertisement | advertise on newsday

Game 5 in the best-of-seven series is tomorrow at Bell Centre, and Game 6 returns to the Garden on Saturday.

Nothing came easily for the Blueshirts, who couldn’t get a third, insurance goal past Price and had to stave off a Canadiens push in the final minutes of the third period. The Rangers had failed to do so in Game 2 in Montreal, when Tomas Plekanec scored the tying goal with 17.3 seconds left in regulation, and in a 4-3 overtime loss.

This time, the Rangers survived, forcing the Canadiens into eight icings in the third period, but when Price was pulled, it turned into a nail-biter, in part because a Shea Weber bomb from the point rang the post with 1:18 to play.

“After what happened in Montreal, you know for sure the game is not over until it’s over,” Lundqvist said. “So we worked really hard until the end and made some big plays and some big blocks when we had to. It felt like we earned this one. We needed this for so many reasons. It’s no secret we’re real disappointed the way things have been going at home the last two years in the playoffs. We needed this win for this series moving forward.”

The Rangers attacked and controlled the play for two periods, but defensive lapses — odd-man rushes and breakaways — almost cost them. Lundqvist bailed them out. Fast’s unassisted goal gave the Blueshirts a lead at 11:39 of the first period. Canadiens defenseman Andrei Markov couldn’t handle a puck that bounced off his skate behind the goal line. Fast swept in to collect it, skated right to the crease and beat Price between his pads.

A bad line change triggered a 2-1 break for Torrey Mitchell and Shea Weber, and with Nick Holden vainly sliding to try to block the cross-ice pass, Lundqvist didn’t have a chance and Mitchell scored easily at 18:37 of the first for a 1-1 tie.

The Blueshirts didn’t score on the power play again and are 0-for-12 in the series, but they denied all three Canadiens power plays.

“We’ve got to make this place hard to play for opposing teams,” Skjei said.

Now they’ll have another chance on Saturday.