ALBANY, N.Y. — It took 65 minutes of playing time and five rounds of a shootout, but the Portland Pirates’ patience was rewarded Saturday night against the Albany Devils.

Andy Miele tied the game with 5:48 remaining in regulation, and Chris Conner, Chris Brown and Ethan Werek scored in the shootout as the Pirates rallied for a 5-4 American Hockey League victory at the Times Union Center.

Mike Lee, who relieved starter Mark Visentin after Albany’s fourth goal, stopped three of five attempts in the shootout.

“He’s done that like three times for us, he’s come in when we’re down and he’s won the game,” Portland Coach Ray Edwards said. “He’s a closer. He’s our Dennis Eckersley.”

Despite a 43-24 edge in shots, the Pirates trailed for most of the second and third periods until Alexandre Bolduc threaded a pass to Miele, who split the defense and beat Devils goaltender Jeff Frazee.

Albany scored four goals on only 12 shots against Visentin to open a 4-2 lead.

“We know how they are,” Edwards said. “They’re very opportunistic, they’re very patient, and they capitalize when you give them chances. The chances that we gave them they scored.

“We had to stay patient. We had enough chances to win the game, so I felt like we deserved to win.”

The Devils had turned the momentum in their favor with a three-goal second period.

Mike Sislo got the first of his two goals at 2:05. Albany took its first lead at 7:34 on a power play, which Joe Whitney finished with his 25th goal of the season.

Sislo’s second goal, a low wrist shot off a rush, made it 4-2 and brought Lee into the game. Bolduc got Portland within a goal before the end of the period, pushing home a rebound of Brown’s shot.

Special teams were both a boost and a detriment to the Pirates. They scored twice with the man advantage, but they also allowed two power-play goals.

“We’ve been trying to focus on our discipline,” Edwards said. “We’re the top team in the league as far as minors go. We’ve been trying to stay out of the box. Even though they scored a couple, we only took four penalties, which is a good thing for us.”

The Pirates didn’t take long to get started, thanks to an Albany penalty just 31 seconds into the game. On the power play, Miele snapped a wrist shot into the net while Brown screened Frazee.

Portland’s first penalty, for too many men on the ice, resulted in the first AHL goal for Reid Boucher, who led the Ontario Hockey League with 62 goals this season.

The Pirates’ power play came through again late in the first. Conner’s initial shot was stopped by Frazee, but Nick Johnson poked the puck into the goal on his second swing.

“The first period could have been a lot worse than it was,” said Albany Coach Rick Kowalsky, referring to Portland’s 18-5 shots advantage. “They ran the shot clock up. They do a very good job of just funneling pucks to the net, not all quality chances. They skated. They played very well, and they had us on our heels in the first.”