ANAHEIM, Calif. — Though the Anaheim Ducks found themselves trailing at the end of the first period despite controlling play, head coach Randy Carlyle had a simple message: Stick with it.

The Ducks did that and erupted in the second period to start a critical five-game homestand off with an important win.

Rickard Rakell and Adam Henrique scored 1:35 apart to give Anaheim the lead during its four-goal second period, and the Ducks went on to beat the Pittsburgh Penguins 5-3 Wednesday night.

"Time for us to get a couple bounces I think," Wagner said, as Anaheim scored four goals in a period for first time since doing it in the third period at Buffalo last Feb. 9.

Chris Wagner and Ondrej Kase also scored for Anaheim in the middle period, and Hampus Lindholm added an empty-netter in the final second of the game. John Gibson stopped 30 shots to help the Ducks improve to 7-3-1 in their last 11 games.

Jake Guentzel, Phil Kessel and Evgeni Malkin scored for the Penguins, who snapped a four-game win streak. Tristan Jarry made 28 saves.

With the Ducks trailing 1-0, Rakell tied it on a redirect of a shot by Francois Beauchemin at 4:17 of the second. Henrique then put them ahead at 5:42, beating Jarry with a wraparound while the rookie was caught flatfooted at the opposite post trying to get his stick back.

Wagner scored on a short-handed breakaway to make it 3-1 at 9:24, notching the third special-teams goal of his career, all of which have come this season.

Kase's smooth breakaway backhand with 1:32 left in the period capped off the scoring deluge. Kase, who also had an assist, has five points in his last three games.

"I think they take chances and they play run-and-gun, so you're going to get your chances. Tonight we buried a good amount of them and that's what got us the W," Wagner said.

Kessel had a power-play goal to make it 4-2 with 10:25 remaining in the third, and Guentzel added a power-play goal with 5:54 remaining to pull the Penguins within one. Sidney Crosby had assists on both goals, giving him 13 points and 10 assists during a five-game point streak.

"We just made big mistakes in the second period, and give up that many goals and that many breakaways in a short period of time you're putting yourself in a tough spot," Crosby said. "We didn't help ourselves."

Lindholm capped the scoring with 0.1 seconds left to finally seal the win, but Carlyle was disappointed the Ducks let the Penguins back in the game with undisciplined penalties knowing Pittsburgh has the best power play in the NHL. The Penguins have 22 power-play goals on the road, four ahead of Vancouver, Tampa Bay, Philadelphia and Winnipeg tied for second-most.

"It was disappointing, obviously, that we took two penalties and they scored two goals to make it exciting, but I guess the entertainment of tonight's game was up there," Carlyle said.

Malkin's 20th goal of the season gave the Penguins a 1-0 lead late in the first period. A sustained forecheck eventually resulted in a takeaway by Carl Hagelin, leading to Malkin scoring from the right circle. It was Malkin's sixth goal in the last five games and gave him 20 for the fifth straight season and 10th time in his career. He joined Mario Lemieux, Jaromir Jagr and Crosby as the only Penguins with at least 10 seasons of 20 goals.

Penguins goalie Matt Murray left the team for its three-game California road trip following the death of his father on Tuesday.

NOTES: Ducks LW Andrew Cogliano served the final game of his two-game suspension for an illegal check to Kings F Adrian Kempe. . Hagelin extended his point streak to four games, with one goal and four assists in that span. ... Ducks D Cam Fowler had two assists.

UP NEXT

Penguins: Visit the Los Angeles Kings on Thursday.

Ducks: Host the Kings on Friday seeking their second win in the Freeway Faceoff rivalry in six days.

___

More AP NHL coverage: https://apnews.com/tag/NHLhockey