It was an evening for zeroes and perfection, Derek Stepan said.

Shortly after the Rangers were blanked Sunday night for the first time this season in a 2-0 loss to the Ottawa Senators and goalie Craig Anderson at the Garden, Stepan did the math.

“They were perfect defensively,” he said, “and when they’re perfect defensively, you have to execute perfectly. Zero mistakes. They didn’t make one all night. They get a goal in the second and one off a bad bounce, but . . . you don’t win any games with zero goals.”

He was spot on. Ottawa, which won its fourth straight, shut down the Rangers, particularly on the power play.

The Blueshirts’ power play had been sliding downhill with one goal in 11 opportunities in the previous five games, and it went 0-for-4 against the Senators, who were quick with their sticks on poke checks and breaking up passes. In their two power plays in the second period, the Rangers managed no shots on Anderson (33 saves).

“We needed to strike on the power play,” Ryan McDonagh said. “Our tic-tac-toes, or seam plays, come off shooting first and getting them running around out of position, and we’ve got to find a way to get back to it. Win a draw and in the first five or six seconds, get the puck to the net and go from there.”

advertisement | advertise on newsday

Ottawa — ranked sixth on the penalty kill and 29th on the power play — made the most of its man-advantage when a clearing attempt deflected off a referee, two Rangers moved toward Mike Hoffman, and Mark Stone took his pass and beat Antti Raanta at 16:11 of the second period. “It was just a broken play. They got a quick shot,” said Raanta (18 saves). “You want to make the save short side, but . . . just a bad bounce.’’

A Rangers miscue early in the period set up the Senators’ first goal. Brady Skjei had chased Tom Pyatt behind the net and along the goal line, leaving space in front. Kevin Klein took a stride toward Pyatt, leaving Jean-Gabriel Pageau alone for the pass in front, and Pageau quickly beat Raanta at 1:54. It was only the eighth shot for the Senators.

It wasn’t unusual for Anderson to have to be strong: Ottawa is ranked 28th in the NHL in goals. “We knew exactly how they were going to play. Nothing surprised us,” said Raanta, who took his first loss of the season after five wins. “They were blocking lots of shots [23] and after the second, when they got the early goal, it was a battle to get pucks through.”

The closest the Rangers came to scoring was with about 7:35 left in regulation when a puck got behind Anderson, but defenseman Mark Borowiecki swept it away.

Former Ranger Derick Brassard, who returned to the Garden for the first time since being traded for Mika Zibanejad last summer, said the Senators were prepared as well.

“I think they’re the best offensive team in the league,” Brassard said. “We couldn’t change anything. That’s how we’ve been playing all season.”