Artemi Panarin #10 of the Rangers and Filip Chytil #72...

Artemi Panarin #10 of the Rangers and Filip Chytil #72 celebrate after Panarin scored a goal against the San Jose Sharks for his third goal of the game at SAP Center on December 12, 2019 in San Jose, California. Credit: Getty Images/Ezra Shaw

SAN JOSE — Up and down, the Rangers' season continues to go. Win, then lose, then win.

The pattern continued Thursday night when the Rangers bounced back from their loss Tuesday in Los Angeles with a 6-3 comeback victory over the San Jose Sharks at the SAP Center in the third game of their four-game western road trip.

Mika Zibanejad scored the tying and go-ahead goals in the third period and Artemi Panarin added two third-period goals himself, completing his first hat trick as a Ranger and his first against a team other than the Rangers.

The victory gave the Rangers (16-12-3) a 10-1 record since Oct. 22 in games immediately following a loss. They have one game left on the road trip Saturday afternoon in Anaheim against the Ducks.

The Sharks, playing their first game under interim coach Bob Boughner, who took over the team Wednesday after Pete DeBoer was fired, took a 3-2 lead at 4:12 of the third period when defenseman Brenden Dillon scored his first goal in his last 106 games. But Barclay Goodrow was sent off for tripping Chris Kreider and the Rangers took advantage, tying it on Zibanejad’s power-play goal at 8:49.

Zibanejad added his second goal of the game to put the Rangers ahead 4-3 at 13:10. Panarin scored to make it 5-3 at 16:49 before adding an empty-netter at 17:36 for the hat trick.

“We just were relentless, I thought,’’ a proud coach David Quinn said. “Once the power play delivered and made it 3-3, you could feel the momentum change on our bench, and the attitude … There was an eagerness and a determination from our guys that ‘we just made it 3-3, let’s finish the job.’ ’’

“This was a good game,’’ Zibanejad said. “A good answer from the last game in L.A.’’

Coming off a disappointing 3-1 loss to the last-in-the-West Kings on Tuesday night in Los Angeles, Quinn changed up his lines Thursday, putting Ryan Strome back at center and back on the same line with Panarin. Brendan Lemieux’s undisclosed injury, suffered in Tuesday’s game, forced Quinn to bring Micheal Haley into the lineup after being scratched the previous four games. Greg McKegg was bumped up from the fourth line to take Lemieux’s spot on the third line with Filip Chytil and Jesper Fast.

Strome and Panarin have showed this season that they have a special chemistry together, and after separating them for Sunday’s game in Las Vegas, Quinn put them back together late in the loss to the Kings. The pair connected on Thursday as Strome set up Panarin’s first goal, which gave the Rangers a 2-1 lead at 7:56 of the second period.

San Jose had taken the early lead when Tomas Hertl scored a shorthanded goal at 9:13 of the first period. The Sharks nearly doubled their lead late in the period when a one-timer by Brent Burns clanged off the goalpost, hit goaltender Alexandar Georgiev and caromed slowly toward the goal line. Most of the puck was over the line before defenseman Marc Staal managed to prevent it from getting all the way over. After a couple of attempts, he was able to clear it to safety.

Fast tied the score at 1-1 at 5:02 of the second period, finishing a pass from Chytil after Chytil made a slick move to get around a defender on the right wing and sent a diagonal backhand pass back to Fast from below the goal line.

Panarin’s goal gave the Rangers the lead, but Logan Couture tied it at 2 at 11:32 with his 10th goal.

After Dillon scored and then Zibanejad got his two goals, Rangers rookie Kaapo Kakko was called for a tripping penalty with 5:49 left in the game. But the Rangers’ penalty kill came up huge, holding the Sharks without a shot on goal. In fact, Dillon’s goal was the last shot on goal the Sharks had.

Zibanejad said the Rangers were unconcerned with the possibility that the Sharks might get a boost after the coaching change.

“That was not our focus whatsoever,’’ he said. “I didn't really think about it. I think all the message, basically was to kind of response from — respond from that game in L.A. You know, it wasn't fully good enough [the loss to the Kings]. We did some good things, but it wasn't enough. And that was the biggest thing for us today.’’

More Rangers