KANSAS CITY, Mo. — The Kansas City Royals had a chance for a big homestand as they try to stay in the race for an AL wild card.

They fell way short.

Joakim Soria yielded a two-run homer to Justin Upton with two out in the eighth inning, and the Royals lost 6-5 to the Detroit Tigers on Sunday.

Kansas City (70-66) opened its six-game homestand with an 8-5 victory over the New York Yankees last Monday. But the Royals dropped four of the next five games, with each of the losses by one run and two in extra innings.

“We could have very easily been 6-0 this homestand,” manager Ned Yost said. “We just couldn’t capitalize on a couple of opportunities in the Yankees series.”

The World Series champions are four games back of Baltimore and Detroit for the second wild card.

“It was definitely one of the tougher homestands we’ve experienced,” first baseman Eric Hosmer said. “It’s just uncharacteristic of our team to blow leads late in the game like we did. But we’ve got to continue to keep pushing, keep fighting and see if we can shake some things here out at the end.”

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.”

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

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.

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.

GORE STEALS

Terrance Gore ran for Salvador Perez in the seventh and swiped second base. He has more career steals, 12, than plate appearances, seven. The only other player with more career steals than plate appearances is Herb Washington, 31 steals with no plate appearances.

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.

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…. 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.