The Rangers had thought they were over the hump, on the verge of staging their best comeback of the season against, of all teams, the NHL-leading Washington Capitals.

But Saturday’s matinee at Madison Square Garden ended with a familiar script. A late-third period goal allowed and a victory denied in a 4-3 overtime loss.

“Best team in the league, best record, division rivals. Obviously it would have been a big win,” said Derick Brassard.

Trailing 2-0 in the third period, the Rangers scored three goals in 7:17 to grab a 3-2 lead at 13:11 on Viktor Stalberg’s deflection of Keith Yandle’s point shot. A Capitals’ coaches offside challenge on the play was denied, and the goal stood.

But with goalie Braden Holtby pulled for an extra skater, Niklas Backstrom jammed a rebound under Henrik Lundqvist with 5.7 seconds left in regulation to send the game to overtime.

“I felt as soon as we took the lead [that we’d win],” Ryan McDonagh said. “But they were able to find a way. We definitely should have been trying to defend the front of the net there, myself, and take away [Backstrom’s] time and space.”

advertisement | advertise on newsday

The Capitals had been attacking, and after an icing with 54 seconds left, Rangers coach Alain Vigneault chose not to use a timeout. “They had their guys out there,” he explained. “Dom [Moore] was out there and was fresh. Our guys knew how we wanted to play 6 on 5, we had the people I wanted out there. Mac might have been a little bit tired there, but we got the puck out, he decided to stay out there. Unfortunately, we left a good player in front of the net all alone.”

Lundqvist’s opinion was a little different. “Our players were tired, there is no question,” he said. “A little break before the last faceoff would have been good, but we didn’t take that break, so we got caught out there. It’s just frustrating.”

Said Backstrom: “We were lucky to get two points.”

In overtime, the Rangers could have skated off with two, but Rick Nash and Derek Stepan were denied in front, and in the next moment, Alex Ovechkin’s end-to-end rush and 499th career goal crushed the Blueshirts’ rally.

“I get a look that with another inch it could have bounced off the stick and still go in the net, but he [defenseman Nate Schmidt] gets a good solid stick on it and they go down and score,” Stepan said. “I don’t know what else I can do other than the move I made.”

“You think it’s over but he stops the puck,” said Ovechkin, who fired a wrister through McDonagh’s legs and past Lundqvist at 1:25. It was the 20th goal of his remarkable career against Lundqvist, the most against any goalie.

With the two points, the Capitals (31-7-3, 65 points) moved 16 points ahead of the Rangers (22-14-5, 49) atop the Metropolitan Division. And Ovechkin crept closer to becoming the fifth-fastest player to reach 500 regular-season goals. This was his 800th game.

After Ovechkin scored on Dan Girardi’s giveway with 15 seconds left in the first and Justin Williams banked a puck off Lundqvist from the right post in the second, Oscar Lindberg, Kevin Hayes and Viktor Stalberg got pucks past Holtby in the third and the emotions rose at the Garden, only to crash.

“For me, this is more about taking a step forward as a team,” said Vigneault. “We battled back from a two-goal deficit against one of the best defensive teams in the league and one of the goaltenders who make it hard on a lot of teams. We were real close to getting it done. Two chances to win in overtime and couldn’t do it. They had theirs and did it.”