UNIONDALE, N.Y. — Kevan Miller scored the go-ahead goal late in the second period, Tuukka Rask stopped 43 shots, and the Boston Bruins beat the New York Islanders 5-2 Thursday night.

Reilly Smith, Patrice Bergeron, Torey Krug and Zdeno Chara also scored for Boston, which won for the seventh time in 10 games. Smith and Milan Lucic had two assists each.

John Tavares and Michael Grabner scored for New York, while Jaroslav Halak stopped 28 shots. It was the Metropolitan Division-leading Islanders’ fifth loss in 22 games (17-5-0) at home this season.

Miller put the Bruins ahead for good with 3.4 seconds left in the second. He intercepted Halak’s clearing attempt at the right wing boards just inside the blue line, and fired a quick shot that found the back of the net to give Boston a 3-2 lead.

Krug’s goal 1:45 into the third essentially decided a game that had seen wild momentum shifts. Chara added an empty-netter with 2:06 left.

Boston enjoyed a 2-0 advantage midway through the first due to the duo of Smith, Bergeron.

Smith opened the scoring with 6:01 left in the first period by driving to the net and redirecting Milan Lucic’s feed past Halak. Bergeron pushed the lead to 2-0 with a power-play goal 2:10 later.

A misplay by Rask allowed the Islanders back into the game.

Rask couldn’t control Tavares’ dump-in from the neutral zone, and the New York captain lifted a backhander into the net 8:25 into the second to cut the deficit to 2-1. The goal was Tavares’ 23rd of the season and his fourth in four games.

Grabner drew the Islanders even with 4:48 left in the second with his fifth of the season.

LIGHTNING 5, RED WINGS 1: Cedric Paquette had three goals, and Tampa Bay beat Detroit for its franchise-record ninth consecutive home win.

Steven Stamkos and Mark Barberio also scored for the Lightning, who leapfrogged the Red Wings into first place in the Atlantic Division by a point.

CANADIENS 1, RANGERS 0: Max Pacioretty scored with 4:17 left, sending Montreal to a win at New York.

Pacioretty converted a wrist shot from above the right circle that appeared to surprise goalie Henrik Lundqvist.

That was enough to give Carey Price his 26th win and third shutout of the season in a 24-save effort for Montreal.

BLUES 5, PREDATORS 4: Kevin Shattenkirk scored the winner in the shootout to lift St. Louis at home.

Jaden Schwartz, T.J. Oshie, Steve Ott and Ryan Reaves all scored in regulation for the Blues, who improved to 8-0-1 over their last nine games. Brian Elliott made 33 saves for St. Louis.

PANTHERS 3, BLUE JACKETS 2: Sean Bergenheim scored the go-ahead goal late in the third period to lift host Florida to a much-needed win.

Aaron Ekblad and Jonathan Huberdeau also scored for the Panthers, and Roberto Luongo made 30 saves.

FLYERS 5, JETS 2: Wayne Simmonds, Chris VandeVelde, Nick Schultz and Brayden Schenn scored, leading Philadelphia to its fourth win in five games.

Sean Couturier added an empty-netter, and Steve Mason made 36 saves.

STARS 6, SENATORS 3: Jamie Benn scored two goals, and the Stars beat the Senators in Jason Spezza’s first game in Ottawa since he was traded to Dallas in the offseason.

John Klingberg, Colton Sceviour, Ales Hemsky and Trevor Daley also scored for Dallas, and Kari Lehtonen made 25 saves.

COYOTES 3, MAPLE LEAFS 1: Martin Hanzal scored the go-ahead goal and Mike Smith stopped 24 of 25 shots as Arizona won at Toronto.