Eric Fehr celebrates one of his two goals with Alex Ovechkin. (Mike Carlson/Getty Images)

Just as they looked like another game had slipped through their fingers — a two-goal lead was relinquished for the fifth time in the past eight games — the Washington Capitals found the mettle to fight back.

The Tampa Bay Lightning rallied from a two-goal deficit to tie the game with less than six minutes remaining in regulation, but a frenzied push resulted in a goal by Eric Fehr off a deflection in front with 51.5 seconds left to secure a 4-3 victory Thursday night, snapping the Capitals’ four-game losing streak.

It was just the third win in the past 10 games for Washington, which had scored three goals on nine shots in the first period to establish its initial lead. But the Lightning outshot the visitors, 24-11, in the final 40 minutes to gradually claw their way into the contest and require the late heroics.

“That’s the kind of stuff you can build momentum off of. Obviously it wasn’t pretty but we had a lot of energy on the bench after we scored,” said Fehr, who recorded a pair of goals. “We knew how big this win was for our team. I think that will help us build for [Friday when Washington hosts Toronto]. It’s going to be good for us to play a lot of games in a few nights. I think our team will take advantage of it.”

In many ways, this wasn’t the type of game the Capitals are accustomed to playing. They traded chances with speedy Tampa Bay and, despite numerous quality opportunities, couldn’t consistently put the puck on net. While they finished with only 20 shots on goal against Lightning netminder Anders Lindback (16 saves), the Capitals had another 37 shots either blocked or miss the target.

Meanwhile, Philipp Grubauer, making his 10th start in 14 games, faced yet another substantial workload but this one came with more odd-man rushes as Tampa Bay turned anything from a giveaway to a blocked shot into a catalyst for its transition game. Grubauer finished with 33 saves and made quite a few impressive stops in the third period — none better than a stunning split save on Ondrej Palat shorthanded — that prevented the Lightning from establishing momentum.

“They’re a skilled team, fast team, they make plays out of nowhere,” Grubauer said. “You don’t expect a play or a shot and there’s a shot. I knew from the Tampa Bay game back home I had to be ready and it was a good win.”

The game got off to an odd start before the opening puck drop. There were poor ice conditions in the crease Washington was set to defend twice at Tampa Bay Times Forum, which hosted the circus the previous week. After officials conferenced with both teams’ coaches and general managers, all parties determined that the two teams would switch sides of the ice at the 10-minute mark of each period. The anomaly didn’t seem to play a significant role in the outcome, though, and to a man the Capitals said the ice improved as the game progressed.

Tampa Bay took a lead just 4 minutes 8 seconds into the contest when Tyler Johnson scored with a shot high glove side on a breakaway that resulted from a turnover by Troy Brouwer high in the offensive zone.

But the Capitals answered quickly when the new line of Alex Ovechkin, Mikhail Grabovski and Fehr scored on an odd-man rush. Ovechkin raced down the right wing and found space for a pass to Fehr, who was cutting through the left circle and fired a snap shot through a screen provided by Grabovski to pull Washington even.

Then the Capitals tapped into their most consistent source of offense — the power play.

A wrister from the top of the circles by Mike Green was redirected twice, first by Joel Ward and then Grabovski as it found its way past Lindback for a 2-1 advantage at 10:37. On the man-advantage again in the final minute of play, Marcus Johansson made a power move from below the goal line out in front of the net to stuff the puck between Lindback’s pads. It was Johansson’s second goal in as many games and gave Washington a 3-1 lead heading into the intermission.

But there’s nothing inherently comfortable about a two-goal lead for the Capitals these days.

In the second period, Washington suddenly couldn’t put the puck on net. The Capitals were outshot 8-1 to start the middle frame, a stretch that culminated with B.J. Crombeen beating Grubauer, high-glove side once again, with 6:45 gone in to cut Tampa Bay’s deficit to 3-2.

“Second period we had some really good waves but we didn’t get it to the net enough. We talked about it between periods,” Coach Adam Oates said. “You can’t get away from your game and the winning goal turns out to be the same type of play we talk about. There’s moments in the game you can’t lose focus.”

The Lightning continued to surge. Palat had one would-be goal waved off for having kicked the puck across the goal line before 14 minutes elapsed, but with 5:30 remaining in regulation he cashed in, tipping a shot by Matt Carle past Grubauer to make it 3-3.

As time ticked down, Oates went with that new-look Ovechkin line once again. They swarmed the offensive zone and after a turnover by Martin St. Louis allowed the Capitals to keep the play alive, Green fired a shot on net that Fehr would redirect in front to capture a win that couldn’t come soon enough.

“We needed some positives, to get a win, to get some confidence,” Johansson said. “To feel that we can win hockey games again is huge.”