CLEVELAND - With a five-run lead, 8-3, and two innings left, it seemed a reasonable bet that the Royals had pretty much put the game away and were about to end their road trip on a winning note.

Even after reliever Jacob Barnes gave up a solo homer in the eighth to make it a four-run game, the lead seemed significant enough.

Royals closer Ian Kennedy emerged from the bullpen rested - he last pitched Monday - and ready to put the stamp on a road win and send everyone home.

Except he didn't.

Kennedy, who entered the day tied for the major-league in saves since May 30, gave up four ninth-inning runs, including a pair of home runs. Franmil Reyes' three-run bomb with two outs and two strikes sent the game into extra innings and the Indians faithful into raucous celebration.

However, the Royals got a 10th-inning home run from first baseman Ryan O'Hearn in order to secure a 9-8 win Sunday afternoon in front of an announced 29,360 at Progressive Field. The Royals avoided being swept by the Indians.

"That would've been a gut-punch for us," Royals manager Ned Yost said. "We were battling, battling. Soler hits the big home run to give us the lead in the eight, and we end up scoring three more. Poor Ian just had a tough day. He hadn't pitched much here lately. It was just one of those where they got a hold of some pitches and put a four-spot on the board."

O'Hearn hit two home runs, including the game-winner in the 10th against Indians reliever Nick Goody, and Jorge Soler also homered. Infielder Nicky Lopez also had two hits and three RBIs for the Royals.

"I was looking to damage," O'Hearn said of the homer off Goody. "I wouldn't say I was looking to hit a home run, but I was definitely looking to do damage. Guy has a good slider. I was looking to stay away from chasing in the dirt and get a fastball. He gave me one that I could handle."

O'Hearn, who'd enjoyed an incredibly productive start to his big-league career in 2018, struggled at the start of this season to that point of having been demoted to Triple A in June.

Since returning to the majors July 27, he hadn't found much luck despite feeling as though he'd been having better at-bats and hitting the ball hard fairly consistently. He'd batted .103 (7 for 68) since rejoining the major-league club.

"It's been tough, and to come out and help the team and have a big home run at the end is something I'm going to build off of," O'Hearn said.

Royals left-hander Eric Skoglund allowed two runs on two hits and three walks in five innings. Both runs came on a second-inning home run. Skoglund threw 83 pitches in his first big-league start since Sept. 30.

Soler's eighth-inning home run, his 36th of the season, moved him within two of tying Mike Moustakas' single-season club record of 38.

Soler's blast in the eighth broke a 3-3 tie, and Alex Gordon scored on a wild pitch to give the Royals a three-run edge. Lopez lined a two-out, two-run, bases-loaded double off the base of the right field wall to stretch the lead to 8-3 as the Royals batted around in the inning.

The Indians added solo home runs in the eighth and ninth innings to close the gap and set the stage for the three-run, game-tying shot.

Francisco Lindor hit a solo home run off Kennedy with one out in the ninth. With two out, Carlos Santana drew a walk, Yasiel Puig singled to left and then, after a wild pitch put runners on second and third, Reyes hit a towering homer to left-center that tied the score.

Royals right-hander Jorge Lopez, who started and got the win Monday night in Baltimore, recorded his first career save with a 1-2-3 10th inning, which include two strikeouts.

"It feels great... I knew I had to be ready (in the 10th)," Lopez said. "I knew I had to trust my stuff. My expectation was that I was the last guy in the bullpen, so I really had to execute pitches. I know they got some great hitters. But I had to attack."

The Royals return home and host the Oakland Athletics on Monday. Right-hander Brad Keller (7-13, 3.95) will start for the Royals, while former Royals pitcher Homer Bailey (11-8, 5.06) will start for the Athletics.