KANSAS CITY, Mo. (AP) -- Max Kepler's RBI single drove in the tiebreaking run and Eddie Rosario added a run-scoring hit to cap Minnesota's three-run rally in the eighth and the Twins beat the Kansas City Royals 8-7 Friday night.
Minnesota scored five runs in the last three innings to avoid its first three-game losing streak of the season.
Ryne Harper (3-0) pitched one-plus inning to pick up the win despite allowing Jorge Soler's 21st leadoff home run in the eighth that pulled the Royals back within one. Taylor Rogers got the last six outs for his ninth save in 11 chances.
Cheslor Cuthbert had three hits and four RBIs -- tying career highs in both -- for the Royals, who have lost a major league-high 26 games in which they've held a lead. Kansas City has been outscored 177-125 after the sixth inning this season.
Trailing 6-3, the Twins pulled within one on Nelson Cruz's two-run single in the seventh.
Miguel Sano started Minnesota's rally in the eighth with a leadoff homer off Jake Diekman (0-5) to tie the score. Pinch-hitter Mitch Garver then walked and Jonathan Schoop singled. Max Kepler's single to right drove in pinch-runner Willians Astudillo with the go-ahead run, with Schoop advancing to third and Kepler taking second on the throw. After Jorge Polanco and Cruz hit fielder's choice grounders, Rosario singled to left to drive in Polanco to make it 8-6.
Royals starter Jakob Junis allowed three runs and six hits in six innings.
Martin Perez gave up six runs -- four earned -- in five innings for the Twins.
The Royals scored three runs in the first inning for the second straight game. Cuthbert had an RBI double down the left-field line for the first run. With two outs, Humberto Arteaga rolled a grounder to short, but Polanco's throw pulled first baseman C.J. Cron off the bag and Soler scored. Martin Maldonado singled against the shift to drive in Cuthbert to make it 3-0.
Cron led off the second with a 424-foot home run to center to get the Twins on the scoreboard.
Minnesota tied it in the fifth with two outs. Rosario's single scored Schoop and sent Cruz to third. Rosario then stole second, and an errant throw by Maldonado allowed Cruz to score the tying run.
Cuthbert untied it in the bottom of the fifth with a three-run home run to give the Royals a 6-3 lead.
Twins C Garver came out of Thursday's game with left heel soreness. He was not in the starting lineup Friday. "It was more of a precautionary removal last night," manager Rocco Baldelli said. "He felt something and because he didn't know what it was, he didn't want to push himself in anyway. We wouldn't want him to." Garver entered the game as a pinch-hitter in the eighth.
Twins RHP Blake Parker is expected to return from the Family Medical Emergency Leave List on Saturday. His wife was experiencing complications with her pregnancy. "I've got a pregnant wife at the house," Parker said. "There was a little bit of complications there, but everything seems to be back on track and good to go."
Royals 3B Hunter Dozier was recalled from his rehab assignment Friday. He has been on the 10-day injured list with a right oblique strain since June 3 (retroactive to May 31). He played Monday through Wednesday at Double-A Northwest Arkansas before returning to Kansas City Thursday for the birth of his second child. His wife, Amanda, gave birth to a daughter named Blake. "It's been a whirlwind. It's definitely a blessing. We brought a little girl into the world, and Mom and baby are doing well. I didn't get much sleep, but I feel good." ... In a corresponding move, the Royals optioned OF Jorge Bonifacio to Triple-A Omaha.
RHP Jose Berrios (8-3, 2.86 ERA) will start for Minnesota. He'll face Royals LHP Danny Duffy (3-3, 4.64 ERA) in the third game of the four-game series.