KANSAS CITY, Mo. — The Detroit Tigers answered Kansas City’s late rally with another big swing by Justin Upton.

Upton hit a two-run homer with two out in the eighth inning, sending the Tigers to a 6-5 victory over the Royals on Sunday.

“We had some great at-bats earlier in the game that we didn’t come through on,” Upton said. “We came through right there. It’s definitely a September feel. They’re in the hunt, we’re in the hunt. Both teams are battling, the crowd is into it. It’s fun. It makes it a lot more fun.”

Upton also doubled in J.D. Martinez in the second. He has seven homers and 18 RBIs in his past 14 games.

Miguel Cabrera was on first after a leadoff single when Upton drove a fastball from Joakim Soria (4-7) over the wall in center for his 20th homer, giving Detroit a 6-5 lead. The seven losses are a career high for Soria.

“That was a really good pitch,” Soria said. “Sometimes you have to tip your cap to the hitter.”

Shane Greene (3-3) pitched 1 1/3 innings for the win. Francisco Rodriguez worked the ninth for his 38th save in 42 opportunities.

The Royals batted around in a four-run seventh, highlighted by Jarrod Dyson’s two-run triple with two out. Paulo Orlando doubled home Dyson, but the lead was short-lived.

“It’s a teeter-totter back and forth with this team,” said Andrew Romine, who had two hits for Detroit, including an RBI double in the seventh. “From what I’ve seen the last couple of years since I’ve been here, it’s the same thing every game. So, we know that nobody’s out of the game. We’re not out of it, no matter how many runs. They’re not out of it, no matter how many runs, so we’ve just got to stay mentally locked in.”

Alcides Escobar opened the Kansas City ninth with a double and advanced on Dyson’s groundout. Before Dyson bounced to second, he drove a ball just outside the right-field foul pole. The Royals asked for a review.

“That ball couldn’t have been foul by six inches,” Royals manager Ned Yost said. “I don’t think it was much more. It was so close we couldn’t tell on the replay. We could not get an angle on it. We just thought let New York look at it and see what they think. Again it’s a matter of inches and inches didn’t work out in our favor today.”

Escobar was stranded at third when Alex Gordon bounced to second and Orlando grounded out to third.

Martinez also homered for the Tigers. He is hitting .397 with eight home runs and 17 RBIs since coming off the disabled list on Aug. 3.

Tigers left-hander Daniel Norris was charged with three runs and four hits in six-plus innings. He struck out seven and walked one.

Escobar homered in the third, tying it at 1 and hiking his hitting streak to 12 games.

Royals starter Edinson Volquez gave up four runs and seven hits in 6 2/3 innings.

BOYD’S RETURNING

Tigers left-hander Matt Boyd will be recalled Tuesday to start at the White Sox. Boyd went 5-2 with a 4.23 ERA in 16 games, including 14 starts, for Detroit before being optioned to Triple-A Toledo, where he was 2-5 with a 2.25 ERA in 11 starts.

TRAINER’S ROOM

Tigers: OF Cameron Maybin has been out since Monday with a bruised left thumb. … RHP Mike Pelfrey (lower back strain) gave up nine hits in 3 1/3 innings in a rehab start Saturday for Triple-A Toledo at Columbus. “I guess four of them were infield hits; they didn’t get to the dirt,” Tigers manager Brad Ausmus said. “His velocity was good. He looked healthy. We’ve got to figure out if we want to try to find another rehab start for him or whether to activate him.”

Royals: Gordon, who left in the ninth inning Saturday with a sore right ankle, was not in the starting lineup Sunday, but was intentionally walked as a pinch hitter in the seventh and then stayed in the game. “It was more precautionary, more than anything else,” Yost said. “He was fighting me to play.” … LF Lorenzo Cain has not played since Tuesday because of left wrist inflammation.

UP NEXT

Tigers: RHP Justin Verlander, who was selected the AL pitcher of the month for August after going 4-0 with a 1.69 ERA, and White Sox LHP Chris Sale are scheduled to start on Monday at U.S. Cellular Field.

Royals: RHP Ian Kennedy, who went 3-0 with a 1.86 ERA in August, will start Monday at Minnesota in the opener of a six-game trip. The Twins are recalling RHP Jose Berrios from Triple-A Rochester to start.