BOSTON — David Krejci had his fourth career hat trick, David Pastrnak had two goals and an assist, and the Boston Bruins had their highest-scoring game since 2012 on Thursday night, beating the Pittsburgh Penguins 8-4.

One night after the Boston Celtics posted a season-high 134 points in the same building, the Bruins had their biggest offensive output of the year.

Pittsburgh’s Ollie Matta scored 35seconds into the game, but from there on it was mostly Bruins.

Boston led 2-1 before the 3-minute mark, 3-1 after six minutes and 5-2 with just under four minutes to play in the first before Riley Sheahan scored with 4 seconds to play in the period.

The Bruins added three in the second – two on the power play from Krejci, giving him a hat trick with 25:27 still to play – and one from Pastrnak. It was Krejci’s first three-goal game since 2014; he also has had two in the playoffs.

The Bruins have won back-to-back games since the trade deadline when they acquired Rick Nash and Tommy Wingels and signed Team USA Olympic captain Brian Gionta.

Nash had a goal and an assist, and Gionta had two assists.

Tuukka Rask made 22 saves for the Bruins.

Casey DeSmith stopped just two shots in 5:27 before he was replaced, trailing 3-1.

Tristan Jarry made 28 saves the rest of the way.

Matta also scored with 15 minutes left to make it 8-4. Phil Kessel scored the other goal for the Penguins, who lost their third in a row.

David Backes and Torey Krug also scored for the Bruins, who haven’t lost in regulation to the Penguins at home in eight games since 2013.