Updated

Ryan Callahan is only 10 games into his tenure as captain of the New York Rangers, and nothing spells leadership more than two goals and an assist in the long-awaited first home win of the season.

Doing it against the NHL's hottest team makes it even better.

Callahan scored twice in the Rangers' three-goal second period, shortly after New York let a two-goal lead evaporate, and carried his club to a 5-2 victory over the Sharks on Monday night that snapped San Jose's five-game winning streak.

The Rangers (4-3-3) didn't sulk or lose confidence when the Sharks tied it two days after New York let a 4-1, third-period lead slip away in a 5-4 shootout loss at home to Ottawa.

"We kept going at them," Callahan said. "We know they are a good team and they weren't going to lay down easily. It was a good character win."

Artem Anisimov also scored in the second after Ryan McDonagh and Derek Stepan had goals in the first. Martin Biron made 24 saves to improve to 2-0 as Henrik Lundqvist's backup. Dan Girardi, Erik Christensen and Brandon Dubinsky all had two assists.

All that, and fan favorite Sean Avery could be back in the lineup Thursday if he clears waivers Tuesday.

"We knew we had to have a good effort because they're a good team," Dubinsky said. "We played the right way, pretty close to 60 minutes. It certainly feels good right now."

Joe Pavelski and Logan Couture had goals for the Sharks (6-4), who were trying to sweep a six-game road trip. Antti Niemi stopped 26 shots.

"These points are big," Pavelski said. "Other teams have gotten them against New York and we wanted them."

While the Sharks acknowledged they would have gladly taken a 5-1 trip when they left San Jose 1-3, they still felt the sting of not finishing the perfect trip. Bad penalties and overall sub-par play made this loss hurt worse.

"The problem is you get on the plane and feel good about your trip, and you should somewhat, but you go home on a losing streak," coach Todd McLellan said. "I'm not overly pleased with what we threw out on the ice. We are a better team than that."

Callahan put New York ahead 3-2, just as a Rangers power play ended, and capped the second-period spurt by pushing the lead to three goals with 47.7 seconds left. He also had the primary assist on McDonagh's opening goal. Stepan made it 2-0 with a power-play goal, but like Saturday, New York couldn't hold it.

Pavelski started the Sharks' comeback with 2:10 left in the first, and San Jose used a dominant shift in the second to get even at 2 when Couture took advantage of exhausted defensemen.

"The competition level went up in the second period, but there was not enough in the tank and not enough between the ears to win a game," McLellan said.

Just as Madison Square Garden was about to turn on the home team, the Rangers regained the lead and built on it.

Callahan took a crisp pass from Christensen and slammed a shot in from the left post with 6 minutes left in the second — just as Colin White's delay-of-game penalty ended. That started the game-turning surge that brightened the costume-clad Halloween crowd.

"We needed to score the next one before they did," Rangers coach John Tortorella said. "If they score the next one, it ends up being a pretty tough building to play in."

Christensen struck again moments later when he nudged the puck ahead to Anisimov, who bounced back from being shaken up on Saturday and scored his first of the season with a nifty backhanded shot that seemed to fool Niemi at 16:42.

"It was our most complete game of the year," Christensen said. The sign of a good team is learning their lesson. Against Ottawa, having the three-goal lead and letting it get away, we didn't want to make the same mistake."

There was some tension heading into the third period as San Jose was given a power play in the closing seconds of the middle frame, but New York killed it and protected the lead.

Pavelski netted his sixth goal of the trip when he put in a rebound of Douglas Murray's drive that hit both posts. The Rangers then got stuck in their zone for about two minutes.

Defensemen Steve Eminger and Jeff Woywitka couldn't get off the ice, even after the puck left the zone briefly. Pavelski then found Couture, who fired in a one-timer at 11:03.

Momentum then shifted back to the Rangers.

"Too many soft plays, and all of a sudden it's 5-2," Pavelski said. "Too many dumb penalties for us right now."

NOTES: Rangers C Mike Rupp missed his third straight game because of a left knee injury. ... C Andre Deveaux made his Rangers debut. ... Pavelski also had five assists on the trip, giving him 11 points in six games. ... Niemi earned the win in the first four games of the trip. ... The Rangers outshot an opponent for the first time this season.