UNIONDALE, N.Y. — The Boston Bruins scored a pair of goals in less than two minutes spanning the second and third periods Thursday night as they opened the post-All-Star portion of the schedule by beating the New York Islanders 5-2 in front of a sellout crowd at Nassau Coliseum.

Defenseman Kevan Miller snapped a 2-2 tie by scoring with 3.4 seconds left in the second and defenseman Torey Krug scored 1:45 into the third for the Bruins.

Right winger Reilly Smith and center Patrice Bergeron scored in the first period while left winger Milan Lucic added an empty-net goal with 2:06 left for the Bruins (26-16-7), who have won seven of their last nine (7-1-1).

The win ensured Boston would remain at least seven points ahead of the Florida Panthers in the race for the final wild -card spot in the Eastern Conference.

Goalie Tuukka Rask made 43 saves for the Bruins.

Center John Tavares and right winger Michael Grabner scored for the Islanders (32-15-1), who lost for just the second time in their last eight games (6-2-0) and the fourth time in 13 games (9-4-0). New York remained three points ahead of the Pittsburgh Penguins in the Metropolitan Division but missed a chance to move into first place overall in the East.

Goalie Jaroslav Halak recorded 28 saves.

The Islanders outshot the Bruins 15-11 in the first period but Boston scored twice in span of less than three minutes to take a 2-0 lead.

With 6:01 left, Smith scored after taking a perfectly threaded pass from Lucic, who tucked it past Islanders right winger Cal Clutterbuck and to Smith. With Islanders center Anders Lee closing in on Smith, the puck ticked off Smith’s stick and past Halak.

A tripping penalty on Islanders defenseman Calvin De Haan 23 seconds later gave the Bruins a power play and Bergeron capitalized with 3:51 to play. Bergeron deked Islanders defenseman Thomas Hickey and beat Halak, who was screened by center Carl Soderberg.

A spectacular effort by Tavares finally got the Islanders on the board 8:25 into the second period. Tavares, barreling in on four Bruins, chipped the puck over their heads. The puck skidded to Rask, who poked it out as a charging Tavares descended upon him and fired it into the net.

Less than seven minutes later, Tavares set up the game-tying goal less with a pass from behind the Boston net to ex-Bruins defenseman Johnny Boychuk, whose shot from the slot bounced off the stick of Grabner and past Rask with 4:48 left.

The Bruins took the lead in surprising fashion with just 3.4 seconds left in the period. Halak, standing behind the Islanders’ net, cleared the puck, but it was intercepted by Miller, whose shot from the blue line sailed into the net.

Krug doubled the Bruins’ lead when his shot from just in front of the blue line found its way between the four players — two from each team — in front of Halak and over his right shoulder.

NOTES: The ceremonial first puck was dropped by Mike Bossy, who became the sixth and final Hall of Famer from the Islanders’ Stanley Cup dynasty to be honored with a “mini-locker night” during the final season at Nassau Coliseum. … The Islanders had one healthy scratch: D Matt Donovan. … The Bruins scratched the healthy duo of D Matt Bartkowski and RW Jordan Caron. … Boston was one of four teams that had at least seven days off during the All-Star break. The Bruins, Ottawa Senators and San Jose Sharks all played Thursday for the first time since Jan. 21, while the St. Louis Blues played Thursday for the first time since Jan. 19.