PITTSBURGH (AP) — A big second period ended up being just enough for the Calgary Flames.

Michael Frolik had the first of four second-period goals for Calgary, and the Flames held on to snap a season-long four-game skid with a 5-4 win over the Pittsburgh Penguins on Saturday.

Frolik, Austin Czarnik, Travis Hamonic and Sam Bennett scored during a mid-game 17-minute span for Calgary, which held off a late Pittsburgh charge that included a pair of third-period power-play goals by Evgeni Malkin.

“They’re a good team and they had a good pushback there at the end,” said Bennett, whose goal with 1:29 left in the second period ended up being decisive. “We got on our heels a little bit, but in the end, we gutted it out and that’s a huge win for our team after not the best showing in the last couple games.”

Calgary got its only win on a four-game, eight-day trip and avenged a 9-1 loss to Pittsburgh in October during the teams’ other meeting this season.

Despite numerous chances playing 6-on-5 over the game’s final 90 seconds, the Penguins couldn’t get the equalizer.

Malkin had three points after serving a one-game suspension for swinging his stick at Philadelphia’s Michael Raffl.

“I think we fought hard,” Malkin said. “Just (wish) we would have played better 5-on-5.”

Mike Smith made 34 saves to win for the first time since Jan. 13 for Calgary, which entered Saturday tied for the best record in the Western Conference.

The Flames never trailed after Andrew Mangiapane opened the scoring 7:06 into the game.

Sidney Crosby had a goal and two assists for the Penguins, who welcomed back defenseman Justin Schultz from a 53-game absence because of a fractured left leg. Schultz assisted on Jake Guentzel’s goal that tied the game at 1 late in the first period.

But the Penguins allowed at least five goals for the seventh time over their past 17 games and are 7-9-1 in that stretch. They have dropped to the final playoff spot in the Eastern Conference. They entered Saturday one point clear of ninth-place Carolina.

Malkin nearly pulled Pittsburgh back from a 5-2 deficit with goals at 5:42 and 14:41 of the third period. Each of those was assisted by Crosby, but Crosby could not convert two prime scoring chances in the final minute.

“You know it’s coming, right?” Flames coach Bill Peters said of the Penguins’ late surge. “We made it a little harder than we would’ve liked by putting them on the power play.”

Before he was relieved by Casey DeSmith for the start of the third period, the Penguins’ Matt Murray allowed five goals on 24 shots, though his performance was at least in part attributable to shoddy defense and bad luck.

The puck on the goal credited to Mangiapane — the second of his career — hit at least three sticks after it was shot from the left point by Oliver Kylington.

The goal that gave the Flames the lead for good 1:29 into the second period was a loose puck swatted in when no Penguins player picked up Frolik after Murray had stopped Matthew Tkachuk.

Ninety-three seconds after that, Czarnik’s third of the season was a shot from the top of the left circle that deflected off the stick of a Penguins defender. And Hamonic’s goal from the right-wing boards with 3:58 left in the second hit Guentzel’s stick on the way in.

Bennett’s goal 2½ minutes later gave Calgary five goals in a game for the 18th time this season. The Flames moved into second in the NHL in goals.

“Obviously, there’s stuff you still want to clean up but everything’s moving back to where it was when we were buzzing,” Smith said. “That’s a good team there. ... We wanted to finish this road trip off on a right note here and get two points tonight.”

NOTES: Flames C Derek Ryan had three assists, the second three-point game among the 210 he’s played in the NHL. ... Penguins RW Phil Kessel had two assists, the first of which (on Crosby’s goal) accounted for his 800th career point. Kessel is the 17th U.S.-born player to reach that milestone. ... Crosby has eight points over his past four games.

UP NEXT

Flames: Calgary will return to the Scotiabank Saddledome for the first time in 11 days when it hosts the Arizona Coyotes on Monday.

Penguins: The Penguins play home games on consecutive days for the second of three times all season, hosting the New York Rangers on Sunday.