BOSTON -- Sidney Crosby scored the go-ahead goal midway through the third period and had two assists, and the Pittsburgh Penguins recovered for a 6-5 win against the Boston Bruins at TD Garden on Thursday.

Crosby, who was named to play in the 2024 NHL All-Star Game just before puck drop, gave Pittsburgh a 6-5 lead at 11:19 with a power-play goal through traffic. Brad Marchand tied it 5-5 for Boston with a short-handed goal at 3:08 after Pittsburgh led 5-2 early in the second period.

“Weird start with five [goals] in the first eight minutes, but some games happen like that and you got to be able to handle it,” Crosby said. “They get a big one short-handed there. Momentum swung a couple times there both ways. So just one of those games where last goal is [going to] win, and we got the last one.”

PIT@BOS: Crosby wires puck home on power play to put Penguins ahead

Kris Letang had three assists, and Lars Eller and Drew O'Connor each had a goal and an assist for the Penguins (19-14-4), who have won six of eight (6-1-1). Erik Karlsson had two assists, and Alex Nedeljkovic made 24 saves.

“Throughout the course of the game, there was a lot of good and then some not-so-good,” Pittsburgh coach Mike Sullivan said. “But I really liked how we responded. We didn’t allow it to get us down and snowball into something worse.”

David Pastrnak and Morgan Geekie each had a goal and two assists, and Marchand scored twice for the Bruins (23-8-6), who had won four straight. Jeremy Swayman made 29 saves.

“I don’t like our ice management,” Boston coach Jim Montgomery said. “I don’t like the odd-man rushes we gave up, whether it’s on the power play or 5-on-5. Giving up an odd-man rush, it cost us a penalty that ended up getting the sixth goal. It’s just we’re not making sound decisions. We’re forcing stuff when we don’t need to.”

PIT@BOS: Marchand powers home second goal while short-handed

Marchand gave Boston a 1-0 lead 41 seconds into the first period, rebounding Pastrnak’s shot at the net front.

O’Connor tied it 1-1 at 5:04, knocking in the rebound of Letang’s point shot off Swayman’s pad.

Ryan Graves put Pittsburgh ahead 2-1 at 6:17 on a shot from long range.

Pastrnak, who was also named an All-Star, tied it 2-2 with a goal 22 seconds later at 6:39, scoring on a backhand shot after finding open space in front of the net.

“It’s fun to win those games, maybe not for the goalies,” Nedeljkovic said. “But I mean it’s a heck of a lot better than coming out on the losing side for us. … They were on top of us to start there. It can be hard to stay positive and stay with it, and I thought we did a great job of that all night.”

PIT@BOS: Pastrnak knots it up with nifty backhand move

Jake Guentzel gave the Penguins a 3-2 lead at 7:21, finishing Crosby’s centering pass.

Eller extended it to 4-2 at 15:58, going top shelf with a slap shot from the right side.

Jeff Carter pushed it to 5-2 at 6:38 of the second after scoring on a rebound.

Geekie cut it to 5-3 at 9:51 with a wrist shot from the right circle before Jake DeBrusk made it 5-4 at 19:24 on a slap shot from the point.

“I think it shows a lot of character [from] the [locker] room battling like we did,” Geekie said. “We never really had a lead tonight (after the first five minutes) and we just kept fighting. Like I said, it’s one of those games we just keep building off of.”

PIT@BOS: Guentzel buries Crosby's pinpoint pass by Swayman

With Swayman pulled for an extra skater at 17:19, Boston put two shots on goal and had seven more attempts blocked by Pittsburgh, which held on for the 6-5 final.

“You got to give them credit,” Marchand said. “They have a lot of talent on that team. They make a lot of plays. A couple were lucky bounces, even the game-winner was off [Bruins defenseman Hampus Lindholm’s] shaft.

“But again, you give one of the best players in the world (Crosby) time and space, he’s going to make plays. Couple bounces there early that [we] would’ve liked to have back, but yeah, missing coverage against a team like that can’t happen, so we need to be better there.”

NOTES: The Penguins and Bruins combined for five goals in the first 7:21, topping the Arizona Coyotes and Los Angeles Kings (8:55) on Oct. 27 for fastest five goals to start a game this season. … Evgeni Malkin played his 1,100th NHL game, and had one shot on goal in 16:38. His 1,261 NHL points (485 goals, 776 assists) trail only Crosby (1,400) for the most among active players through their 1,100th game. … Marchand’s short-handed goal was the 34th of his career, the most in Bruins history. It also marked Boston’s first short-handed goal of the season.