BOSTON (AP)Jeremy Swayman rebounded from a rough stretch with 23 saves and the Boston Bruins clinched a playoff spot by holding off the Pittsburgh Penguins 2-1 on Saturday to halt a season-high three-game losing streak.

Trent Frederic and Erik Haula each scored a first-period goal for Boston, which went on the skid after winning 17 of 21.

”It’s really an important win for us, especially as of late,” Swayman said. ”Just the fashion that we did it, making the small plays, simple plays, everything was crisp and on point for us. Just super excited, clinching the playoffs, and to do it at home is a cherry on top.”

Former Bruin Danton Heinen scored for the Penguins, who fell to 2-5-1 in their past eight. Casey DeSmith stopped 27 shots.

The Bruins went 0 for 2 on the power play, extending their scoreless stretch to 25 straight.

The 23-year-old Swayman, who seemed to be a lock to be the No. 1 goalie for the playoffs about a month ago, lost his previous three decisions when he allowed a few soft goals. He made a handful of solid stops when the Penguins had two power plays in the second period was steady with nine stops in the third.

”I thought he looked composed, he was confident playing the puck,” Boston coach Bruce Cassidy said. ”I think he needed this as much as we did to be honest with you. He’s a young guy … sometimes older guys can play through things not going their way. Young guys, you’re never too sure, especially in that position.”

Swayman looked relaxed and was smiling talking about his own play afterward.

”I felt good, he said. ”It was one of those games that I wanted to make sure I was square to the puck, seeing it well and get a feel for it. Definitely took a lot of positives from today, excited to move forward with it.”

Looking eager to erase their recent sporadic play, the Bruins grabbed a 2-0 edge just over two minutes into the game.

”I thought the final 58 (minutes) we were competitive and played a solid game,” Pittsburgh coach Mike Sullivan said. ”The first two we weren’t ready to play.”

Frederic backhanded in a rebound from the edge of the crease in the opening minute. Haula then fired a shot from the right circle that ricocheted into the net off Penguins defenseman Marcus Pettersson at 2:01.

Heinen fired a rising wrister over Swayman’s left shoulder 5:38 into the second.

Having clinched a playoff spot in their previous game on Thursday night with a victory over the Islanders, the Penguins had a slow start. They steadied their play after being outshot 11-6 in the first.

”That’s a tough spot to put ourselves in,” Penguins center Teddy Blueger said. ”They’re a good defensive team, very structured. It’s tough to score on them and when you’re chasing the game they’re more diligent and it makes it tough.”

The Penguins clinched a postseason berth for the 16th straight season, the longest active streak of North American pro sports teams.

CHASING A MILESTONE

Sidney Crosby’s next goal will give him 30 for the 10th time, matching Hall of Famer Mario Lemieux and Jaromir Jagr as the only ones in franchise history to post 30 or more in 10 seasons.

PRODUCTIVE DAY SHIFTS

The Bruins improved to 10-2 in afternoon games.

WINTER CLASSIC FOES

The NHL announced earlier this week that the teams would meet in the Winter Classic on January 2, 2023, at Fenway Park, which is the home of the Boston Red Sox and owned by John Henry, who also owns the Penguins.

NOTES: Bruins leading goal scorer David Pastrnak missed his sixth consecutive game with an undisclosed injury and defenseman Hampus Lindholm was out for his fifth straight because of an upper-body injury, but defenseman Brandon Carlo returned after being sidelined one game with an unspecified injury. … With Boston goalie Linus Ullmark out with an undisclosed injury, Troy Grosenick dressed as the backup. … Pittsburgh won the first meeting between the teams, 4-2 in Boston on Feb. 8 when Heinen scored twice. … Bruins defenseman Derek Forbort played his 400th game. … Crosby has 65 goals against Boston, the most of any active player. … Boston forward Taylor Hall hasn’t scored a goal in the eight April games.

UP NEXT

Penguins: Off until Thursday when they host the Bruins.

Bruins: At St. Louis on Tuesday.

More AP NHL: https://apnews.com/hub/nhl and https://twitter.com/AP-Sports