Jose Ramirez hit a go-ahead homer in the 14th inning and the Cleveland Indians held on to beat the Kansas City Royals 5-4 Thursday night in a game that lasted just shy of five hours and finished after midnight.

Jake Bauers singled home Jason Kipnis later in the 14th off Brian Flynn (2-2) to add an insurance run — and Cleveland needed it.

A.J. Cole earned his first save since May 15, 2015, in his second major league appearance. After allowing the first three batters to reach, Cole retired the next three in order, striking out Bubba Starling to end the game.

Kansas City got one run in the 14th on Jorge Soler's sacrifice fly.

Francisco Lindor homered on the first pitch of the night for the Indians, who remained two games behind first-place Minnesota in the AL Central.

Nick Goody (2-0) threw two scoreless innings for the win. Cleveland's bullpen worked 8 2/3 innings, allowing just one run and four hits.

Indians starter Adam Plutko pitched 5 1/3 innings and gave up three runs on seven hits while making his second consecutive start against the Royals.

Lindor hit his 17th home run but Hunter Dozier answered in the bottom of the first with his 16th of the season, a two-run shot to put Kansas City up 2-1.

The Indians scored twice in the sixth to briefly take a 3-2 lead before the Royals tied it in the bottom half. Neither bullpen flinched for the next seven innings.

Josh Staumont pitched out of jams in the 11th and 12th to throw two scoreless innings in his big league debut for the Royals. Kevin McCarthy and Scott Barlow also tossed two scoreless innings apiece.

Starling had a career-high three hits and has a nine-game hitting streak dating to his second career game.

Mike Montgomery matched his longest outing of the season, pitching five innings and giving up one run on five hits. Since July 15, Royals starters are 6-2 with a 2.45 ERA.

Trainer's room

Indians: Tyler Naquin was out of the lineup for a third straight game with a tight right hamstring. Naquin did some running in the outfield pregame to test out the muscle. Cleveland manager Terry Francona said the outfielder could be available Friday. ... Dan Otero (right shoulder inflammation) threw one inning Wednesday for Triple-A Columbus, but reported to the team Thursday that he still didn't feel right. Francona said the Indians are trying to figure out what the next step is.

Up next

The Royals and Indians play the second of their four-game series Friday night. Zach Plesac (4-3) starts for Cleveland, and Kansas City will hand the ball to Jakob Junis (6-8), who was placed on the paternity list Wednesday for the birth of his third child. Junis is pitching as well as he has at any point in his career, allowing just three runs in 20 innings over his last three starts. Plesac will make his second straight start against the Royals. He was the winning pitcher Sunday, tossing six innings of two-run ball.