OTTAWA — Hats rained down not once but twice Monday night at Canadian Tire Centre.

Washington’s T.J. Oshie was the first to get the honor late in the second period after completing his fifth career hat trick, much to the delight of the Capitals fans in the Canadian capital. The Ottawa Senators’ Drake Batherson completed his own hat trick in the third, and the Capitals’ Alex Ovechkin nearly joined the party late but had to settle for two goals — his sixth and seventh in six games this season.

Oshie’s third goal held up as the game-winner in Washington’s 7-5 victory. Ovechkin scored the final goal — his second of the night — at 10:46 of the third to give the Capitals some breathing room.

“He was flying today,” Ovechkin said of Oshie. “... I think their line play very well, and it was nice to see him get a hatty.”

Ovechkin’s latest outburst gave him 737 career goals. He is four shy of matching Brett Hull for fourth on the NHL’s all-time list.

“I think our line played good,” Ovechkin said when asked about his hot start. “... Obviously [Evgeny Kuznetsov] right now feels it and [Tom Wilson] is always going — and I just try to find the open spot and put the puck in.”

Washington was up 4-1 entering the second period before the Senators rattled off three straight goals in the first 12 minutes to tie it. With his team needing a spark, Ovechkin gave the Capitals a 5-4 lead on a breakaway at 16:27. Then Oshie tallied his third of the night at 19:52 by banking in a wraparound attempt off an Ottawa player, giving him four goals on the season.

Washington (4-0-2) was sitting pretty with a 6-4 lead heading into the final period before Batherson made things interesting with his third goal at 6:32. Ovechkin gave the Capitals some margin for error, Ottawa (2-4-0) could not respond, and the Capitals escaped with two points.

“It was not your typical game, but we found a way to win it,” Coach Peter Laviolette said.

Here’s what to know from the wild win:

Back and forth

Ottawa started strong, grabbing a 1-0 lead just 2:26 in on a long snipe from Batherson. But Washington’s offense quickly came to life. Oshie answered first, scoring twice in less than five minutes to put the Capitals ahead.

Nick Jensen had the third goal with a right-point shot before fellow defenseman John Carlson added the Capitals’ fourth with a slick fake leading to a snipe from the circle.

Then Ottawa made its run. Josh Norris cut the Capitals’ lead to 4-2 with a one-timer from the right circle 5:57 into the second. Not long after, the Senators capitalized with Oshie in the penalty box after an interference call. Chris Tierney scored on the power play, cutting the Capitals’ lead to 4-3 at 9:37. Batherson got his second goal when a loose puck ended up in front of the Capitals’ net to tie the score at 4 at 11:16.

McMichael, Lapierre in

Connor McMichael and Hendrix Lapierre were both in the lineup after center Nic Dowd did not travel with the team because of a lower-body injury. He is considered day-to-day.

Lapierre, who grew up in nearby Gatineau, Quebec, was playing in front of 15 to 20 family members in addition to plenty more people from his hometown. He was ushered onto the ice before warm-ups to do his second solo lap — a rookie tradition — of the young season.

“I just really want to keep proving that I can play and I can be an effective player here,” Lapierre said before the game. “... I really want to keep working, keep doing the right things correctly and keep playing my game, do the right details correctly. And I think if I do that, good things will happen.”

McMichael’s parents saw him play in a regular season game for the first time. He skated on a line with Oshie and Anthony Mantha, while Lapierre played with Conor Sheary and Daniel Sprong.

McMichael recorded the first two points of his NHL career: He had the secondary assist on Oshie’s second goal and the primary assist on Oshie’s third. McMichael skated a career-high 14:01, while Lapierre played 7:46.

“It was cool,” McMichael said of playing in front of family. “I had that in the back of my mind the whole game.”

Samsonov’s mixed bag

Capitals goalie Ilya Samsonov had mixed results. While he made some timely saves, he was unable to stop a few shots from sharp angles.

Samsonov finished with 32 saves on 37 shots. He made a strong stop to open the third period, denying Alex Formenton on a breakaway with a kick save. He made a sliding save on Nick Paul moments later, denying him a chance from a tight angle.

“There were probably a couple that he would like back, and there are probably a couple that they were incredible saves,” Laviolette said. “That’s probably the best way to describe it. He made a lot of good saves.”

Ottawa goalie Anton Forsberg was pulled after the Capitals scored their fourth goal on their 16th shot. Filip Gustavsson played the rest of the way, yielding three goals on 15 shots.

More from The Post: