KANSAS CITY, Mo. -- The Minnesota Twins again showed the resilience that has allowed them to avoid a three-game losing streak this season.
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 inning, and the Twins beat the Kansas City Royals 8-7 Friday night.
Minnesota scored five runs in the last three innings.
"We never quit," said Miguel Sano, whose tying home run leading off the eighth inning started the rally.
"I think we needed this win today to get back to the way of playing that we had a couple of weeks ago," said Rosario, whose third single of the night gave the Twins their final run. "Everybody was encouraging each other in the dugout."
Ryne Harper (3-0) pitched one-plus inning to pick up the win despite allowing Jorge Soler's 21st leadoff home run in the bottom of 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 RBI -- 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.
"Four of the five runs they scored late against the bullpen came on two strikes," Royals manager Ned Yost said. "We just couldn't put them away."
Trailing 6-3 in the seventh -- the Twins' second three-run deficit of the game -- they pulled within one on Nelson Cruz's two-run single.
Sano's homer off Jake Diekman (0-5) tied the score, and came after he struck out in his previous three at-bats.
"The first couple of at-bats I was struggling like the last few days," Sano said. "I never put my head down. I come into work every day hard. I had the opportunity in that at-bat and I was lucky. I said I needed to do something, a walk, single, whatever. God gave me the opportunity to hit a homer."
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.
"We had several guys come through at different moments," manager Rocco Baldelli said. "It came with big hits, with getting on base and with the long ball. Our guys are resilient and they keep it going."
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's three-run home run in the fifth gave 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. "There was a little bit of complications there, but everything seems to be back on track and good to go," Parker said.
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. ... In a corresponding move, the Royals optioned OF Jorge Bonifacio to Triple-A Omaha.
More AP baseball coverage: www.apnews.com/MLB and www.twitter.com/AP-Sports
Pirates regroup after crushing loss to Cardinals
It seems likely emotions will run high Tuesday as the visiting St. Louis Cardinals and Pittsburgh Pirates move into the second game of a four-game series at PNC Park.
Giants score 3 in the 8th for comeback win
The Giants drive in three runs in the bottom of the eighth inning to get the 5-4 comeback win against the Cubs.
Schwarber tacks on another run with solo HR
Kyle Schwarber add another run to the scoreboard with a solo shot in the top of the third inning to make it a 2-0 lead for the Cubs.
Heaney: Skaggs 'was never afraid to truly be himself'
Andrew Heaney shares some of his favorite memories of Tyler Skaggs at the memorial service for the former Angels pitcher.
Cain makes a great running catch
Lorenzo Cain makes a long run and an off-balance catch to rob Jose Peraza of a hit.
Suarez hits 2 HRs as Reds rally against Milwaukee
Eugenio Suarez hit a pair of home runs, including a two-run, go-ahead shot in the ninth inning off Jeremy Jeffress as the Reds rallied for a 6-5 victory over the Brewers on Monday night.