NEW YORK — Riley Nash scored twice and backup goalie Anton Khudobin made 18 saves as the Boston Bruins beat the New York Islanders 2-1 Saturday night, snapping a four-game losing streak.

Nash broke a 1-1 tie with his second goal of the contest at 4:12 of the third period, beating Islanders goalie Thomas Greiss from the slot for his seventh goal of the season. Dominic Moore assisted on the decisive goal, which lifted Boston two points ahead of the Islanders for the second wild card in the Eastern Conference.

John Tavares scored for New York and Greiss finished with 16 saves.

Tavares had a golden chance to knot the score with just over six minutes left in the third period but rang the puck off the crossbar with the Islanders on their sixth power play of the game.

New York is now 0-3-1 on home ice since earning points in 11 straight (9-0-2), their longest such streak at home since 1982.

Tavares opened the scoring at 10:05 of the first, rifling the puck past Khudobin after skating through and around the Boston defense. Tavares’ 28th goal this season tied the captain with Bob Nystrom for eighth place on the franchise list with 235 goals.

Nash quickly answered, beating Greiss low on the stick side 36 seconds later. The unassisted goal brought loud cheers by many Bruins fans scattered throughout the sellout crowd of 15,795 at Barclays Center.

The Islanders outshot the Bruins 8-3 in the brisk first period.

The playoff-like pace continued throughout the second. Greiss made a number of acrobatic saves and also stopped Drew Stafford and David Krejci on point-blank chances with just under five minutes left.

The chippy play led to several skirmishes particular after Bruins forward David Pastrnak clobbered Islanders forward Stephan Gionta in front of the home team’s bench with about four minutes left in the period. Pastrnak received only a 2-minute roughing penalty.

It was the home team’s third power play of the second but they couldn’t convert against Khudobin, who started in place of starter Tuukka Rask.

The Bruins had a 10-5 shots advantage in the middle period as the score remained tied at 1 heading for the third.

The Bruins had a goal waved off with 4:16 left in the first period when it was ruled that forward David Backes made contact with Greiss.

NOTES: The Islanders won both road games this season against the Bruins, 4-2 on Dec. 20 and 4-0 on Jan. 16, which proved to be Jack Capuano’s last game as Islanders coach before he was replaced by Doug Weight. … The Islanders are 2-10-0 in their last 12 home games against the Bruins, including 0-5-0 in the last five. … The Islanders entered the contest with consecutive road wins over the Rangers and Pittsburgh Penguins. … The Bruins are 13-7-0 since Bruce Cassidy replaced Claude Julien as coach on Feb. 7. The Islanders were without defenseman Johnny Boychuk for the 11th straight game.