NEW YORK — Henrik Lundqvist watched his Rangers teammates dominate the Toronto Maple Leafs at the other end of the ice and couldn't believe he was the goalie trailing by two goals.

Shot after shot was gobbled up in the first period by Toronto's James Reimer as Lundqvist stewed because two of the three pucks that came his way got past him.

Patience paid off late as the Rangers broke out for four goals in third period and turned an early deficit into a stirring 5-2 win Saturday night.

The Rangers outshot Toronto 14-3 in the first, 25-9 through two periods, and 42-17 overall.

"We played great. It was a miracle they were up 2-0 after that (first) period," Lundqvist said. "It was definitely frustrating to sit in here. The feeling is even better now knowing that we stayed patient and made good decisions even though we were behind.

"Everybody who watched the game thought we should be up two goals, at least, but that was not the case."

Not until late.

The Rangers cut their deficit in half in the second period and then erupted in the third. Defenseman Marc Staal tied it at 7:36 and then assisted on Marian Gaborik's tipped game-winner 5:21 later. Brian Boyle's deflected goal pushed the Rangers' lead to 4-2 with 2:52 remaining, and Gaborik completed his four-point night with an empty-net goal.

Instead of falling to 1-4, the Rangers are 2-3 with two games left on a three-game homestand.

"We knew if we were going to play like this, it's going to turn around," Gaborik said. "Even though after the second period we were down, you could see the confidence in this room that we felt good about ourselves."

Brad Richards, who also assisted on Gaborik's winner, got the Rangers within 2-1 in the second. Gaborik added two assists and the empty-netter with 1:15 to go.

On the go-ahead goal, Richards nudged the puck up the wall to Staal, who unleashed a one-timer that Gaborik tipped past the screened Reimer.

Brian Boyle then deflected in Michael Del Zotto's drive to make it 4-2 with 2:52 remaining.

Mikhail Grabovski and James van Riemsdyk scored first-period goals for the Maple Leafs, who fell to 2-1 on the road.

Defenseman John-Michael Liles assisted on both early goals for Toronto, which blew a lead for the second straight game. On Thursday, the Maple Leafs allowed five straight goals in a 7-4 loss to the Islanders after jumping out 3-1.

"We were hanging on and hanging on, but they kept coming and broke us," captain Dion Phaneuf said of the Rangers. "Reims played great. We hung him out."

Reimer was strong throughout before the rough third period. He had to be nearly perfect for much of the game because his teammates generated so few shots.

"I knew I was making a lot of saves," Reimer said. "Then I looked up at saw the '40.' on the board. For most of the night, everything was staying in my glove.

"It was tied late, then they scored two lucky ones. Can't do much about that sometimes."

It was a much-needed win for the Rangers, who were 0 for 4 on the power play and are 2 for 22 overall this season.

The only save Lundqvist made in the opening 20 minutes was off a shot by van Riemsdyk, who instantly put the rebound in for his third goal. The power-play tally was set up when the Rangers were caught with too many men on the ice.

"For 60 minutes, we played really well," Rangers coach John Tortorella said. "We beat ourselves in the first with a couple of bad, bad mistakes. But it didn't bother us. We continued to play."

The only other shot that came Lundqvist's way in the first period was Grabovski's goal. The Maple Leafs had nine drives blocked by New York defenders.

"Mentally it was a test for the team and for me, and we responded in a big way," Lundqvist said. "We just kept coming all night. It was just a matter of time, but you never know.

"We had a great game. We deserved this."

Grabovski gave Toronto a 1-0 lead when he was left alone in front of Lundqvist, stickhandled and then shoved in a shot at 6:25 for his third of the season.

The Rangers had a couple of potential scoring chances, but were denied by Reimer. His best stop came with just under nine minutes left after Nash was sprung free on a stretch pass. Nash snapped a shot that Reimer calmly gloved at his midsection.

New York finally had something to show for its efforts when Richards cleaned up a loose puck in front to get the Rangers within a goal at 5:43 of the second.

Nash's drive from the outer edge of the right circle was deflected in front by Gaborik, who put the puck back in on Reimer. The puck slid toward the left post, and Richards backhanded in his second goal of the season.

Fans got so frustrated with the lack of positive moments from the slumping home team that when Lundqvist made his simple glove save to stop play 40 seconds into the middle period, the crowd let out a sarcastic cheer.