Yes, the New York Islanders are buried in last place in the Metropolitan Division. And, yes, a case can be made that after their selloff at the trade deadline and with star center John Tavares out for the rest of the season, they are the worst team in the league on paper.

Still, the Sharks had their work cut out for them Friday night, and not just because the Islanders are playing carefree hockey that can often make a bad team dangerous. San Jose entered the game after a tough 4-3 shootout over a surging Columbus team less than 24 hours earlier, and with a day off on Saturday on the horizon, a loss wouldn’t have been all that surprising to a New York team that had the last three days off.

The Sharks survived an early push by the Islanders, though, and did just enough in claiming a 4-3 victory, their fifth straight.

A pair of goals from Matt Nieto and Jason Demers just a minute and a half apart in the latter half of the first period was key, according to coach Todd McLellan.

“When I look at the game, it took us 10 minutes probably to get our legs. We were slow, we weren’t executing, we weren’t really engaged,” he said. [Antti Niemi] gave us a chance to stay in it. Getting the lead was important for us tonight. Being able to roll the four lines was important.”

Each of the top three lines ended up on the score sheet, including the third line of James Sheppard centering Marty Havlat and Tommy Wingels, which generated two goals. Demers’ score came on a tic-tac-toe passing playing that started with Sheppard and ended with Havlat’s slick feed to Demers through the slot.

In the second period, Joe Thornton scored after Brent Burns’ kept the play alive by gloving a fluttering puck that was headed toward the neutral zone, and quickly putting it on net. Thornton easily thumped in the rebound.

Sheppard and Havlat teamed up for what was the game-winner later in the second, as Havlat found the top corner past Nabokov, who looked to be screened by his own man with less than two minutes to go in the middle frame.

Sheppard remains a focal point. He has nine points in his last 10 games (1g, 8a) after getting just six points in his first 43. His production on that line, which included Raffi Torres in Havlat’s spot before Torres came out of the lineup again with soreness, has allowed the Sharks the luxury of keeping leading goal-scorer Joe Pavelski on Thornton’s line.

“I haven’t seen James Sheppard play this well, ever,” Thornton said. “He’s playing really, really solid. He’s strong on the puck. He’s just winning so many battles, and with him and Marty, Marty is playing great. He’s healthy again. Tommy Wingels compliments that line really nicely.”

McLellan said: “Depth is showing right now; we’re able to play the four lines, getting contributions from everybody, both goaltenders have contributed.”