For 40 minutes, the Detroit Red Wings dictated the flow and pace Friday night. They buzzed in the Washington Capitals’ zone, converted a pair of power plays and carried a two-goal lead into the third period.

But for the second straight game, the Capitals engineered a third-period rally to snatch two points. Nicklas Backstrom scored the winner in the shootout at Joe Louis Arena to secure Washington’s 4-3 victory after Alex Ovechkin and Michael Latta scored in the final 20 minutes of regulation to force overtime.

The Capitals extended Detroit’s winless streak at home to seven, dating from Oct. 15, while continuing their own recent run of success. Washington improved to 6-1-1 in its past eight games.

“It’s a good sign that we battled back and good thing that we showed that character that we can come back,” Backstrom said. “You don’t want to stop playing after two periods even if you’re behind two goals. That’s something we talked about. We kept working, and we put pucks on net. Eventually we’re going to score, and that’s what we did.”

Washington had a key power-play opportunity at the start of the third but despite quality chances, including Backstrom in front and a whiff by Ovechkin, the Caps couldn’t convert. While the man advantage dried up — the Capitals went 0 for 4 in Detroit and are 0 for 11 in the past three games — the visitors found a renewed energy at even strength when Coach Adam Oates switched up the forward lines.

Oates decided before the period began that he would move Marcus Johansson up to his familiar spot as left wing on the top unit and slide Martin Erat to the second. The hunch paid off.

On the first shift after Johansson joined the first line, he set up Ovechkin’s goal that ignited the rally. The speedy forward eluded Pavel Datsyuk, carried the puck below the goal line and found Ovechkin low in the zone for a shot that knuckled its way over the shoulder of Detroit netminder Jimmy Howard (30 saves) to make it 3-2 with 3 minutes 19 seconds gone in the third.

“I was just looking for a spark as always. I actually thought Ovi was looking a little flat,” Oates said. “Teams have been taking him away on the PP, so I just tried to generate something. We got lucky with it, and the puck had eyes on his goal.”

In what was only a one-shift switch up on the third line later in the frame, Latta recorded his first career goal to tie the contest at 3 with 8:06 remaining in regulation. It was the result of a smart play by the gritty center, who drove to the net hoping for a loose puck knowing Howard likes to come out to challenge shooters. He got one when Howard didn’t control a rebound from John Carlson’s point shot.