What looked like a classic pitchers’ duel before the game took some twists and turns on Friday, with one ace looking rock-solid, but losing, and another ace struggling early, but winning.

When all of the weather-delayed action was over, the Minnesota Twins gave up the field in favor of a postgame Nelly concert and escaped to their clubhouse with a 2-1 win over the Pittsburgh Pirates in the opener of a three-game series.

Minnesota All-Star hurler Joe Ryan (9-4) had to work through the first two innings as his pitch count climbed. He fell behind in the fourth inning, but got bailed out by just enough offense. Pittsburgh right-hander Paul Skenes (4-8) looked untouchable for three innings, only to surrender a Trevor Larnach homer in the fourth, which won the game.

“When you get some opportunities, you really have to take advantage,” Twins manager Rocco Baldelli said, crediting speedy leadoff hitter Byron Buxton for outrunning a potential double play before Larnach’s homer. “Trevor, who was trying to fight through the at-bats that he’s had in the game to that point, gets one and hammers it. And to beat one of the very good pitchers in the leagues, sometimes that’s how you have to do it.”

Jhoan Duran got the final three outs for his 15th save of the season as the Twins improved to 5-2 on their current homestand. With the potential tying run on second in the ninth, Duran struck out Isiah Kiner-Falefa to end the game.

Ryan escaped the first inning without allowing a run, but only after giving up a walk and a pair of hits, which loaded the bases. The second hit was a hard shot back to the mound by Oneil Cruz that deflected off Ryan’s glove and was credited as an infield single. Trainers gave Ryan a cursory glance, but he stayed in the game. His 34th pitch of the frame got Ke’Byran Hayes to pop out to second, ending the threat.

“That’s many for the first two, three innings,” Ryan said. “A little too much for the first.”

By contrast, Skenes threw a dozen first inning pitches and struck out the Twins’ side. He needed just 33 pitches to retire the first nine Twins he faced.

The Pirates put runners on base in each of the first four innings, and broke through with two outs in the fourth. Isiah Kiner-Falefa’s double to right rolled all the way to the warning track, and the throw beat Spencer Horwitz at the plate, but Twins catcher Christian Vasquez could not field the ball cleanly.

The second time through the order went notably better for the Twins, who got an infield single from Buxton, and they took the lead two batters later when Larnach dropped his 13th home run of the season into the front row. Larnach had struck out in his first at-bat but figured out Skenes quickly.

“Honestly, he got me on my first at-bat, I think it was 2-2. Kind of pounding the zone,” Larnach said. “I didn’t want to chase down, especially with a guy in scoring position. At least try to put the ball in play, or get jammed. Recognized all that and just went for it.”

The ball was a line drive, which initially looked like it might glance off the wall.

“I knew it had a chance. I was kind of yelling at it to go over,” Larnach said. “I thought it hit the rail at first, and then I saw the umpire (signal home run). Thankfully, it did go over.”

Skenes was lifted after five innings, having allowed five hits and recording six strikeouts. Ryan, who was named to his first All-Star Game this week, also went five innings, allowing five hits while striking out five.

Minnesota’s Danny Coulombe, Brock Stewart, Louis Varland and Griffin Jax pitched in relief to get the game to Duran.

Correa has ankle sprain

Twins shortstop Carlos Correa left the game in the seventh with a mild right ankle sprain.

Tommy Pham hit a line drive off the wall in right field. DaShawn Keirsey, Jr., played the carom perfectly and fired to second as Pham tried to stretch for a double.

Correa applied the tag for the out, but Pham’s helmet hit Correa’s right leg, which was planted on the bag. Correa rolled to the ground in immediate pain and had to be helped off.

Correa has had surgery on that ankle previously, and has a metal plate which made the collision feel worse initially.

“I felt my ankle get stuck to the bag and then could feel the vibrations going through my plate. I’m ultra sensitive when it comes to that stuff, my ankle. My brain right away went to a dark place,” said Correa, who hopes to play on Sunday in the Twins’ final game before the All-Star break.

“But once we got back in (the clubhouse), the X-rays were clean, I started putting weight on it. It didn’t feel like I fractured it, which when I tried to put my foot down I felt that vibration going throughout my entire bone. At that point I knew I was fine. It was a scary moment.”