Pastrnak made it 2-0 at 3:22 of the third with a one-timer from the left face-off circle while on the power play.
"I think the first period set the tempo for the rest of the game," Pastrnak said. "We had one of the better starts that we didn't for a while, so we just tried to make sure we keep going."
Trent Frederic scored an empty-net goal at 18:42, diving with his outstretched stick to beat Simon Nemec to the puck and push it across for the 3-0 final.
"We had some opportunities around the front of the net that I think if we would have gone up, we would've been able to score," Devils coach Lindy Ruff said. "But we knew it was going to be tight. We kept it tight. We gave ourselves a chance late."
NOTES: Swayman's 12th NHL shutout tied him with Tiny Thompson for the third most by a Bruins goalie 25 or younger (Frank Brimsek, 22; Tuukka Rask, 13). ... Pastrnak has 61 points (26 goals, 35 assists) in 43 games this season, the third time he's reached 60 points in 43 games or fewer (42 in 2019-20 and 43 in 2022-23). Three other players in Bruins history have done so at least three times: Bobby Orr (six), Phil Esposito (six) and Bill Cowley (three). ... Devils defenseman Brendan Smith left at 6:06 of the first with a leg injury. Ruff said he needs to be evaluated further before providing any updates.