SAN JOSE -- Tomas Hertl scored at 1:29 of overtime for the San Jose Sharks, who rallied for a 3-2 win against the New York Rangers at SAP Center on Tuesday.

Alexander Barabanov spun away from K'Andre Miller in the slot and passed to Jan Rutta, who found Hertl below the right circle for the game-winning goal.

"'Roots' and 'Barbie' made a great play," Hertl said. "Huge win for us, and it's nice to have three (wins) in a row."

Nico Sturm and Ryan Carpenter scored in the third period, and Mackenzie Blackwood made 29 saves for the Sharks (13-31-4), who were coming off a 4-3 shootout win at the Los Angeles Kings on Monday and are 3-0-1 in their past four games.

"It was a true team effort," San Jose coach David Quinn said. "Couldn't be prouder of this team, and I've been proud of them on many occasions in a tough season, but no more so than I am tonight."

NYR@SJS: Hertl nets beautiful wrister for OT victory over the Rangers

Adam Fox had a goal and an assist for the Rangers (29-15-3), who have lost three of their past four and seven of 10 (3-5-2). Igor Shesterkin made 19 saves.

"We made mistakes in the third period and it cost us," New York coach Peter Laviolette said. "They were able to tie it up and push it to overtime. That’s disappointing just from that standpoint. We were in a position to win the game going into the third and we didn't get it done."

Fox put New York ahead 1-0 at 7:55 of the first period. He jammed in a loose puck from the edge of the crease after Vincent Trocheck's backdoor pass was broken up by Kyle Burroughs.

Artemi Panarin made it 2-0 at 1:38 of the second period with a shot from above the right circle through traffic.

"I thought we played well," Trocheck said. "Even in the third period I thought we were playing well. We were getting chances, just didn't get a bounce here and there."

NYR@SJS: Panarin dances around to the top of the circle and scores

Sturm cut it to 2-1 at 2:19 of the third period. Erik Gustafsson tried to bank a pass behind the net to Braden Schneider, but it was intercepted by Sturm, who quickly scored off the skate of Shesterkin.

"He's a hardworking player and an honest player," Blackwood said. "It's great to see him get rewarded like that."

Carpenter tied it 2-2 at 4:27 with a redirection of Rutta's one-timer from the right point.

"We stayed right there in the game," Hertl said. "Sure it was 2-0, but we had some chances and we just had to push a little harder because they have a lot of skill."

NOTES: It was Hertl's seventh career overtime goal. Only Brent Burns (10), Patrick Marleau (10) and Logan Couture (8) have more in Sharks history. ... Panarin scored his 17th road goal of the season, which is third in the NHL behind Sam Reinhart of the Florida Panthers (19) and Auston Matthews of the Toronto Maple Leafs (18).