SAN JOSE, Calif. — Thomas Greiss guided the Islanders on a night when they played it a little bit too safe.

Greiss stopped 40 shots, Brock Nelson scored a tiebreaking goal in the second period and the New York Islanders rallied to beat the slumping San Jose Sharks 3-1 on Saturday.

The Islanders improved to 1-1 on their three-game, five-day West Coast trip. The Sharks are 1-3 on their season-opening five-game homestand.

Nelson made it 2-1 at 13:33 of the second period, capitalizing on an open look in front of the goal after Joshua Ho-Sang’s pass from behind the net.

“After we got the lead we just kind of held on, we bent but we didn’t break and we needed some big saves from Thomas,” Islanders coach Doug Weight said.

“These teams, when they’re down, they’re gonna push. … You don’t want to sit back but I think it’s human nature. We have to get it out of our heads. We want to play aggressive and we want to put the puck in good spots. We started making some shoddy decisions, our feet stopped moving for a while, but give (the Sharks) credit, they made a good push. Tommy was great.”

The Sharks led after Kevin Labanc’s power-play goal at 4:16 of the first. Labanc was in the left circle when he rebounded a deflection and fired a wrist shot that slipped through Greiss’ pads.

The Islanders tied it when Anders Lee tipped one in at 17:02 of the first.

Cal Clutterbuck scored an empty-net goal at with 1:10 left in the game.

“It’s nice, first road win of the year, a good bounce back,” Nelson said, referencing a 3-2 loss to the Anaheim Ducks on Wednesday.

“I thought we did some good things in Anaheim and weren’t rewarded. It’s nice to come out on top here.”