The Detroit Red Wings’ offense put them in control in the first period Monday and their late penalty killing put the finishing touches on a 5-3 victory over the Ottawa Senators at the Canadian Tire Centre.

The Red Wings never trailed after racing out to a 3-0 lead in the first period, but the Senators twice cut the deficit to a goal. They had an excellent chance to tie it with back-to-back power plays midway through the third.

But Michael Rasmussen scored his team’s first shorthanded goal in 78 games to put Detroit ahead 5-3 with 7:07 remaining in regulation.

The Red Wings (25-15-5), aided by a would-be Ottawa goal negated due to goaltender inference, and another late penalty kill, bounced back after consecutive losses to Pittsburgh. They regained the top spot in the Eastern Conference with 54 points, though teams right behind them have games in hand.

It was the first of four games between these teams, and the Senators fell to 20-16-5.

James van Riemsdyk scored a goal and added an assist. Andrew Copp, Dylan Larkin, Lucas Raymond also scored for the Red Wings.

John Gibson made 35 saves to improve to 10-2-0 in his past 12 starts.

The Senators scored twice in the second period to cut Detroit’s lead to 3-2 and had the momentum before Raymond fired in a shot from the face-off circle following a pass from J.T. Compher and a little toe-drag move. It was his 12th goal, just his second in 16 games, and his first even-strength tally since Nov. 29.

The Red Wings fell behind by two goals in each of their past two games but struggled at the start in this one, too, as Ottawa registered the first eight shots. But Gibson kept the Senators off the board before his team responded with three unanswered goals in the first period.

Copp scored on a breakaway at 7:06 after stripping the puck from Tyler Kleven in the neutral zone. It was his sixth goal. He has 14 points in 17 games.

Larkin notched his 22nd goal, on the power play, at 13:51. Van Riemsdyk, parked at the net front, made a good play to tap the puck to Larkin following a rebound of Alex DeBrincat’s shot.

Van Riemsdyk capped the surge by scoring his 11th goal with 17 seconds remaining in the period. He spun and fired a shot that deflected in off Nick Jensen’s skate.

The Senators replaced goaltender Leevi Merilainen, who allowed three goals on eight shots, with Hunter Shepard at the start of the second period.

Goals by Claude Giroux (7:33) and Dylan Cozens (14:10 on the power play) in the second period got the Senators back in the game.

The Red Wings host the Vancouver Canucks on Thursday (7 p.m., FanDuel Sports Network).