Vincent Trocheck of the New York Rangers celebrates his second-period...

Vincent Trocheck of the New York Rangers celebrates his second-period goal against the St. Louis Blues with teammates Artemi Panarin and Jonny Brodzinski at Madison Square Garden on Monday. Credit: Jim McIsaac

When the Rangers targeted Vladislav Gavrikov as the player they had to have when free agency opened on July 1, they weren’t thinking so much about what the 6-3, 210-pound defenseman could do for them offensively.

So what he did Monday night essentially was gravy.

Gavrikov, a shutdown defenseman who has done so much to improve the Rangers in their own end of the ice this season, set up two goals in the third period that helped the Blueshirts beat the St. Louis Blues, 3-2.

“He’s a great player all around,’’ said Adam Edstrom, who banged in a drop pass from Gavrikov to give the Rangers a 3-1 lead at 8:56 of the third period. “I know a lot of guys are talking about his defensive game ... but every now and then, he kind of shows that glimpse of what an offensive player he is, and he’s been a great player in this league for a long time. He’s playing very well for us.’’

“When we think of Vladi, we always talk about his defensive prowess,’’ coach Mike Sullivan said. “He’s heavy at the net front; he leans on people, he’s hard to play against. He’s a real good defender ...

“But I think his ability to make some plays off the offensive blue line, they’re sneaky good. He’s been involved in a fair amount of goals over the last little while here just by making pretty good decisions along that offensive blue line [on] when to jump through when we’re trying to create some motion and some movement in the top half of the offensive zone. He’s pretty good at it.’’

It was the Rangers’ second win in 10 games at Madison Square Garden this season and ended their losing streak at four games.

Igor Shesterkin made 19 saves for the Rangers (11-11-2), who won without a couple of key players in captain J.T. Miller, who missed his second straight game with an upper-body injury, and defenseman Will Borgen, who went on injured reserve Sunday and missed his third straight game with an upper-body injury.

Backup goaltender and locker room leader Jonathan Quick also did not dress for the game after suffering a lower-body injury in Saturday’s loss in Utah.

Vincent Trocheck, who skipped the morning skate for what the team called “precautionary reasons,’’ did play, and he scored the Rangers’ first goal at 10:06 of the second period. That tied it after Dylan Holloway’s first-period goal gave St. Louis (7-10-6) a 1-0 lead.

The Rangers took their first lead of the game when Gavrikov fired a shot from near the left-wing boards that Alexis Lafreniere tipped in with the shaft of his stick 40 seconds into the third period. Lafreniere initially worried that he might have touched the puck with a high stick, which would have nullified the goal, but it counted and the Rangers led 2-1.

They made it 3-1 at 8:56. Gavrikov rotated down to the slot as center Sam Carrick carried the puck up to the top of the circle and passed to Adam Fox. When Fox’s shot went wide of everything and hit the back boards, Gavrikov got to it below the goal line and dropped it to Edstrom in the slot.

“It’s something that we practice a fair amount,’’ Sullivan explained of the switch by Gavrikov and Carrick. “And depending on what the [opposing team’s defensive] coverages are, we talk to them about what their options might be and what may work against different coverages. And I thought those guys just did a really good job.’’

Brayden Schenn scored with 1:15 left in regulation to pull the Blues within 3-2.

A double-minor high-sticking penalty to Brett Berard, who was called up from AHL Hartford on Sunday, meant the Rangers had to kill a four-minute power play with 5:51 left in the game, and with 3:00 left, the Blues pulled goalie Joel Hofer, giving them a six-on-four advantage. Gavrikov played more than three of the four minutes, including the final 2:33 of the penalty, as the Rangers killed it.

“It was fine,’’ Gavrikov said of getting caught on the ice for so long on the penalty kill. “We got caught a few times, but I mean, Shesty made a huge save for us, and obviously, the PK was a big part of the success at the end. Four minutes wasn’t easy, but we got it done.’’

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME