NEW YORK — When the New York Islanders needed a big play against San Jose, Anders Lee came through.

Lee had two goals and an assist to lead the Islanders to a 5-3 victory over the Sharks on Saturday night for New York’s third win in four games. Lee’s goal in the first period tied the score and his third-period tally gave his team a much-needed cushion.

“We had a good break in on the first one,” Lee said. “Johnny (Tavares) made a great play over to (Nick Leddy) who used his speed and took it wide. I was able to find a soft spot in the slot there. Then obviously on the second one, just a great play by Johnny. Two great plays by two great players and they were big for us tonight.”

Logan Couture scored all three goals for the Sharks, completing the hat trick with 1:52 remaining to pull them within one. Aaron Dell finished with 18 saves.

Tavares added an empty-netter and assisted on both of Lee’s goals for his first points since he had two goals and an assist Oct. 7 against Buffalo, ending a five-game drought.

Josh Bailey added a goal and an assist, Andrew Ladd also scored and Thomas Greiss made 28 saves as the Islanders won back-to-back games for the first time this season.

“We looked a little faster and we did look like we were playing with confidence most of the game,” Islanders coach Doug Weight said. “We played on our toes and we were aggressive, and I liked their game. I thought the first period was probably the best of the year.”

Ladd’s goal at 3:12 of the third period broke a 2-2 tie. Rookie Mathew Barzal created the scoring chance by taking the puck around the net and then setting up Ladd in the high slot for his second of the season.

Lee’s second of the game and fifth of the season gave the Islanders a two-goal lead with 8:13 remaining as he converted an odd-man rush. Tavares sealed the win with an empty-netter with 55.4 seconds remaining and helped improve the Islanders to 22-4-4 against Western Conference opponents in their two-plus seasons at Barclays Center.

“An empty netter is nice, but he could have had five or six points,” Weight said about Tavares’ performance. “That helps you get out of these types of situations.”

The Sharks scored the game’s opening goal at 6:26 of the second period on the power play. San Jose came away with the offensive draw and Couture scored from the slot, redirected Brent Burns’ point shot past Greiss.

The lead lasted just over a minute as Leddy worked his way to the back of the net and then quickly fed Lee for the tying goal.

The Islanders went ahead 58 seconds later after Joe Thornton made a costly turnover in his own end to give Bailey a point-blank chance. Bailey was able to sneak the puck with a backhander between his skates and past Dell to put New York ahead 2-1.

However, an impressive effort by Jannik Hansen to spin past Brock Nelson in the neutral zone led to a quick feed to Couture, who took a few strides and then fired a shot past Greiss to even the score once again.

“We didn’t defend well,” Couture said of the loss. “We gave them some grade A chances. Just mistakes. I don’t know if was mental or physical from being tired. We need to avoid those.”

NOTES: Tavares moved past Bob Bourne for eighth place on the franchise’s career points list (543) and ninth on the assists list (305), and tied him for seventh in goals (237). … The Islanders held a special pregame ceremony to honor alumni of the organization who were in town for an Islanders Alumni Weekend. Among the players on the ice were Bobby Nystrom, Clark Gillies, Bryan Trottier and Ed Westfall. … The Islanders scratched D Scott Mayfield, F Josh Ho-Sang and F Nikulay Kulemin. … San Jose scratched F Joel Ward, F Barclay Goodrow and D Dylan Demelo. … The Islanders honored Tragically Hip front man Gord Downie by playing music from the band during warmups. Downie passed away on Oct. 17 after succumbing to brain cancer.

UP NEXT

Sharks: At the New York Rangers on Monday night.

Islanders: Host Arizona on Tuesday night.