The Montreal Canadiens snapped their five-game losing streak with a 4-3 win over the San Jose Sharks on Tuesday night at SAP Center.

Joel Armia scored the game-winner shorthanded with 4:04 left in the third period.

Sam Montembeault made his second consecutive start and made 27 saves for the win. Martin St. Louis reached the 100-win plateau as a head coach in the NHL.

Former Boston University teammates Lane Hutson and Macklin Celebrini faced each other in the NHL for the first time. The Sharks rookie had a goal and an assist, while the Habs blue liner had an assist.

In the first period, the Sharks opened scoring on the power play when Celebrini capped off a Harlem Globetrotter-esque passing sequence where all five Sharks on the ice touched the puck. Montreal’s streak of nine straight penalties killed over the last four games was snapped.

The Habs turned the tables early in the second period. It started 52 seconds in with Cole Caufield scoring a one-timer from the hash marks on the power play. Nick Suzuki and Hutson drew assists.

Just over four minutes later, Alex Newhook blasted the puck through traffic to hit double-digits with his 10th goal of the season. Habs up 2-1.

A long review by the officials on a no-goal for the Sharks seemed to motivate the home team and deflate the Habs. Collin Graf responded with his first career NHL goal on a laser that beat Montembeault. 2-2.

Lane Hutson took a high-stick late in the second, and the Sharks were assessed a double minor. In the third period, the Habs took some time to get their power play going, but the second unit finally cashed in when Kirby Dach fed Brendan Gallagher in front for the tap-in. With their second PP goal of the night, Habs regained the lead at 3-2.

The Sharks replied with a power play goal of their own. With Arber Xhekaj in the box, former Hab Tyler Toffoli scored the 3-3 equalizer on a breakaway. Celebrini set him up with the perfect pass.

After Montembeault stoned Celebrini at the doorstep not once, but twice, Jake Evans and Joel Armia teamed up for yet another shorthanded goal. Armia beat Alexandar Georgiev to give Montreal a 4-3 advantage with time winding down.

The Habs won’t necessarily be happy it was a nail-biter against the worst team in the league, but a win’s a win when you’ve lost five straight. The Sharks have lost 11 of their last 13 as they look to win the draft lottery a second straight year.

Officially, Montreal only fired 20 shots on Georgiev, but there were multiple posts and even more misses.

Coach St. Louis tried to shake things up by juggling the lines, and early returns were positive. Josh Anderson joined Kirby Dach and Newhook on the second line and contributed on offence. Patrik Laine found himself on the fourth line and didn’t look confident double-clutching the puck on the power play instead of ripping his trademark one-timer.

Owen Beck also got some reps in Michael Pezzetta’s place and looked like more of a difference-maker. Beck had two shots and three hits in 9:37 of ice time.

Montreal’s California swing continues tonight in Los Angeles. With the win, the Habs finished the night five points back of the Tampa Bay Lightning for the last wild card spot in the Eastern Conference.

Kudos to the Liveblog commenters for staying up with me. Here’s what they said about the win.

3. “Well we got the win, certainly not as convincing as I would like. Liked that second line tonight. Anderson gives them a lot more speed. Loved Becks game. Allowed MSL to roll 4 lines all game. When was the last time we saw that. Out shot again, some very timely saves from Monty.” -Doug Kirkby

2. “We’ll be re-signing Evans and Armia.” -Carin Latzel

1. “Needed the win and got it. Wanted to see more but we’ll take it.” -Kelly Morgan