Ryan O’Hearn led off the 10th inning with his second homer of the game, sending the Kansas City Royals to a wild 9-8 win Sunday over the Cleveland Indians, whose playoff hopes were rocked by losing third baseman Jose Ramirez to a broken right hand.

The Indians tied it in the ninth against Ian Kennedy (1-2) on a solo homer by Francisco Lindor and Franmil Reyes’ stunning three-run shot with two outs.

O’Hearn hit a 2-2 pitch from Nick Goody (3-1) over the right field wall as the Royals salvaged a back-and-forth series finale to snap a four-game losing streak. O’Hearn also homered in the third off Indians starter Shane Bieber.

Royals reliever Jorge Lopez worked the 10th for his first major league save.

Losing the game was secondary to the Indians, who will be without Ramirez for their playoff push. The two-time All-Star will undergo surgery Monday in New York to repair a fractured hamate bone, and the club won’t know his recovery time until after the procedure.

However, Ramirez, who awakened from a puzzling, early-season offensive slump in time to propel the Indians back into postseason contention, won’t be able to help as his teammates try to catch first-place Minnesota in the AL Central or win a wild-card spot.

Trailing by four runs and down to their final strike, the Indians tied it against Kennedy.

Lindor homered with one out before Kennedy walked Carlos Santana with two outs and gave up a single to Yasiel Puig.

Kennedy’s wild pitch moved the runners up and Reyes, whose homer leading off the eighth pulled Cleveland to 8-4, brought them home with a 423-foot shot to left, rewarding Indians fans who hung around after the team fell behind 8-3 in the eighth.

Kansas City had busted open a 3-3 game with a five-run eighth, triggered by shortstop Lindor’s error and highlighted by Jorge Soler’s two-run homer _ a 437-foot drive.

Kevin Plawecki hit a two-run homer for Cleveland. The Indians came in 21/2 games out in the division and clinging to a half-game lead in the wild-card race.

Bieber shook off a wobbly first few innings and stuck around for seven. After allowing the homer to O’Hearn in the third, the All-Star Game MVP retired his final 13 batters, recording seven of his eight strikeouts in that span.

Rookie infielder Yu Chang stepped in for Ramirez and got his first two major league hits.

Chang made an immediate impact after being recalled from Triple-A Columbus when the Indians put Ramirez on the injured list.

He opened the seventh with a triple off Royals reliever Scott Barlow. The drive caromed at an odd angle off the center field wall, and for a moment it appeared Chang might have a chance for an inside-the-park homer before he was held at third by coach Mike Sarbaugh.

As he pulled into the bag, Chang was met with cries of “Yuuuuu” from Indians fans still coming to grips with the stunning loss of Ramirez _ the latest obstacle for the three-time defending AL Central champions who have had numerous major injuries in 2019.

Royals starter Eric Skoglund was sharp in his season debut, allowing only two hits in five innings. The left-hander was suspended for the first 80 games for violating Major League Baseball’s drug prevention and treatment program.