SAN JOSE -- The San Jose Sharks moved to within one point of first place in the Pacific Division with their 12th straight win against the Montreal Canadiens at SAP Center, 5-2 on Thursday.
The Sharks (40-19-8), who haven't lost to the Canadiens at home since Nov. 23, 1999 (3-2 in overtime), trail the Calgary Flames in the division and lead the third-place Vegas Golden Knights by nine points.
Tomas Hertl scored his 30th goal, and Martin Jones made 37 saves for San Jose, which has won three games in a row. Marcus Sorensen had a goal and an assist, and Joe Thornton, Timo Meier and Gustav Nyquist scored.
"I think we gutted out a win tonight," Sharks coach Peter DeBoer said. "I think we're dealing with a little bit of flu going through the team and a little shorthanded. I thought our goalie was our best player tonight, which gave us a chance, and I thought our third period, when we had to have a big period, we got our best period of the game. We did enough to win an important game."
[WATCH: All Canadiens vs. Sharks highlights]
The Canadiens (36-25-7) hold the second wild card into the Stanley Cup Playoffs from the Eastern Conference, two points ahead of the Columbus Blue Jackets. They are tied in points with the Carolina Hurricanes, who hold the first wild card.
Artturi Lehkonen and Andrew Shaw scored for Montreal, which is 3-2-0 in its past five games. Antti Niemi, who made 20 saves against his former team, started in place of Carey Price in the first of back-to-back games for the Canadiens, who play at the Anaheim Ducks on Friday.
"This place isn't an easy place for us to win, for sure," Lehkonen said. "We had our chances to get ourselves back in the game after trailing by two goals, but we couldn't. We have to ignore this game and focus on the one tomorrow night."
Hertl put San Jose ahead 1-0 at 6:55 of the first period when he scored an unassisted goal on a wraparound. It is the first time he has reached 30 goals in his six NHL seasons.
"I'm very excited about it because I still look at myself more as a passer," Hertl said. "I think I'm more a passer than a shooter, but lately the goals are going in and I'm happy."
Video: MTL@SJS: Hertl pots 30th goal on wraparound
Sorensen made it 2-0 at 10:00 with his fourth goal in three games.
Lehkonen scored at 17:56 with a wrist shot from the left face-off circle to cut it to 2-1.
Thornton gave the Sharks a 3-1 lead at 7:46 of the second period when his pass to the low slot went in off Canadiens forward Phillip Danault's stick and past Niemi.
"It's strange," Thornton said of facing Niemi, who played for San Jose from 2010-15. "He was a big part of this franchise for a lot of years. He was a great teammate and a great goalie for us. It was a little bit strange, but a good win for us."
The goal was Thornton's 1,466th point, one shy of tying Stan Mikita for 14th in NHL history.
Video: MTL@SJS: Thornton scores as pass goes off defender
Shaw made it 3-2 at 15:18 when Paul Byron's shot from the high slot deflected off his skate.
"We played well," Montreal coach Claude Julien said. "And sometimes the score doesn't indicate the effort. I thought for two periods we were really, really good. They played better in the third."
Meier increased San Jose's lead to 4-2 at 6:08 of the third period with a backhand from the low slot.
Nyquist scored into an empty net at 19:54 for the 5-2 final. It was his first goal since being traded to the Sharks by the Detroit Red Wings on Feb. 25.
Video: MTL@SJS: Nyquist scores first goal as a Shark
They said it
"The boys came out hard tonight right at the drop of the puck. We battled really hard, but the score didn't go in our favor. We're playing well right now, so it's important to forget about this game and get ready for tomorrow. We kept it close until the third but couldn't capitalize on our chances." -- Canadiens defenseman Victor Mete
"He just keeps getting stronger as the year goes on. He's just gotten stronger and stronger, and you can see his confidence every game get bigger and bigger. He's a huge part of this team now. Thirty goals is an incredible feat. Let's see if he can reach 40." -- Sharks center Joe Thornton on forward Tomas Hertl
Need to know
Canadiens forward Brendan Gallagher did not have a point, and his four-game goal streak ended. ... Montreal rookie forward Jesperi Kotkaniemi was a healthy scratch for the second straight game after playing in the first 66 games. ... Thornton played his 1,551st game to pass Alex Delvecchio for 14th in NHL history. ... It was Jones' 150th NHL victory. ... Sharks forward Evander Kane missed his third straight game with an undisclosed injury. ... San Jose defenseman Erik Karlsson (groin) missed his third straight game and won't play against the St. Louis Blues on Saturday.
Canadiens: At the Anaheim Ducks on Friday (10 p.m. ET; ESPN+, FS-W, TSN2, RDS, NHL.TV)
Sharks: Host the St. Louis Blues on Saturday (4 p.m. ET; NHLN, NBCSCA, FS-MW, NHL.TV)
Video: Hertl pots 30th as Sharks beat Canadiens