David Pastrnak (88) celebrates with his Bruins teammates after one of his two second-period goals Saturday night against the New Jersey Devils at TD Garden. Michael Dwyer/Associated Press

BOSTON — David Pastrnak scored two of Boston’s four second-period goals, Kevin Shattenkirk recorded his 100th and 101st career goals, and the Boston Bruins rallied for a 5-2 victory over the New Jersey Devils on Saturday night.

Jake DeBrusk also had a goal during the second-period scoring burst and Linus Ullmark stopped 31 shots for Boston, which posted its second straight win after a four-game losing streak. Charlie Coyle added a pair of assists.

Luke Hughes and Nico Hischier scored for the Devils, who had their three-game winning streak stopped. Vitek Vanecek made 27 saves and Tyler Toffoli had two assists.

Boston star defenseman Charlie McAvoy left the ice late in the game, favoring his left leg, after crashing into Ullmark while hustling back on a Devils 2-on-1 break.

Trailing 2-0, the Bruins scored four times in just under 12 minutes.

DeBrusk got it going when he took a pass in the slot from Brad Marchand, shifted around Vanecek and tucked in a backhander at 5:35.

Advertisement

Pastrnak then went to work, scoring his team-leading 21st and 22nd goals in a 2:48 span.

On the first, he was cutting to the net from the right wing when Brandon Carlo’s shot from the left point was tipped and sailed over near the winger, who redirected it at the back of Vanecek’s pads before tapping a backhander into the net when the goalie didn’t seem to know that puck was behind him.

Pastrnak’s go-ahead goal came on the power play when he was skating in hard from the right wing, collected a pass from DeBrusk and shifted before putting a backhander into the net at 15:39.

Shattenkirk’s 100th came on a wrister from the right circle at 17:14. He added a power-play score with less three minutes remaining in the game after being set up by Pastrnak.

Hughes scored just 71 seconds into the middle period to give the Devils a 2-0 edge after Hischier’s power-play goal 6:03 into the game.

New Jersey entered the night with the league’s second-best power play.

Boston’s 23-year-old center, Georgii Merkulov, made his NHL debut, and Bruins defenseman Matt Grzelcyk collected an assist in his return after missing three games because of an upper-body injury.