GLENDALE, Ariz. — The Pittsburgh Penguins have struggled in close games recently and giving up a two-goal lead to the team with the league’s worst record was not a good sign.

One shot from Olli Maata changed their fortunes.

Maatta scored from just inside the blue line with 14 seconds left and the Penguins ended a three-game losing streak with a 4-2 victory over the Arizona Coyotes on Saturday night.

“We just stayed with it,” said Penguins coach Mike Sullivan, who became the fourth Penguins coach to win 100 games with the franchise. “It was a little discouraging when they tied it up, but I thought we controlled the play most of the night.”

Pittsburgh pressured Arizona early and took a 2-0 lead on second-period goals by Carter Rowney and Evgeni Malkin.

Arizona got a spark when Nick Cousins scored in the closing seconds of the second period and Max Domi scored early in the third to tie it against the two-time defending Stanley Cup champions.

The teams traded good chances and appeared to be headed to overtime until Maatta beat Antti Raanta to the stick side on a shot from the left point. Raanta smacked his stick on the goal after missing the puck and Sidney Crosby closed it out with an empty-net goal.

“That’s tough. I mean, it was 14 seconds,” said Coyotes coach Rick Tocchet, whose team has lost six straight and nine of 10. “It’s been a season like that and it’s going to build character. We’ll weed this out and these losses are going to build character.”

Pittsburgh came to the desert on a three-game losing streak after falling 2-1 Thursday at Las Vegas. It was the Penguins’ fourth loss in five games, all by one goal.

The Penguins were sharp early, putting constant pressure on the Coyotes in their own zone, outshooting them 26-11 through the first two periods.

Rowney scored in the second period on a nice feed from Bryan Rust after Domi was bumped off the puck in his own zone, creating a 2-on-1. Malkin scored on a rebound with just over minute left in the second, getting the tip of his stick on the puck to trickle it past Raanta.

“All the way through the game I thought we generated some good chances,” Crosby said.

Arizona’s funk has been season-long its first year under Tocchet, playing well for stretches, but unable to sustain it. Arizona entered Saturday’s game with eight losses in nine games and Tocchet called his team soft after a 4-1 loss to NHL-leading Tampa Bay on Thursday.

Arizona had a little more fight against the Penguins, starting with Domi’s roughing penalty for going after Chad Ruhwedel after the Pens’ defenceman ran Clayton Keller into the boards.

Raanta was sharp early, making some tough saves to keep the Coyotes in it. He needed to be, too, with the Coyotes making a parade to the penalty box and the Penguins spending a lot of time in Arizona’s zone.

The Coyotes showed some life after falling into a 2-0 hole, scoring with 8.7 seconds left when Cousins banged the puck in off the crossbar from the left circle.

Arizona carried the momentum into the third period, tying it when Domi scored on a feed from Keller after the Penguins turned it over in front of the crease.

The Coyotes kept it close, but lost when Raanta tried to steer Maatta’s shot wide and had it go off his stick into the goal.

“When you’re a goalie, you want to make sure the game is tied under a minute, you want to make the save,” said Raanta, who stopped 30 shots. “When you make that kind of mistake, it’s tough because you let your whole team down.”

Notes: Coyotes C Zac Rinaldo was out sick for the second straight game. … Pittsburgh is 6-1-1 its last eight games against Arizona. … Coyotes LW Jordan Martinook played his 200th career NHL game. … Malkin had an assist on Maatta’s goal, extending his points streak to seven straight games.