DETROIT (AP) -- The Kansas City Royals began the game by hitting for the cycle as a team, then Whit Merrifield nearly did it by himself.
Merrifield hit a triple as part of Kansas City's four-run first inning, and he later added a single and a double in a 12-9 victory over the Detroit Tigers on Sunday. The Royals hit four homers to drop the Tigers in the AL wild-card race - and avoided elimination themselves.
"I haven't played in the playoffs, but that was as close to a playoff atmosphere as I've been a part of," said Merrifield, a rookie who made his debut for the defending World Series champions in May. "(The Tigers are) fighting for a spot, and they're going to give you your best shot, so you're going to have to play all 27 outs."
Kansas City started the game with a single by Billy Burns, a triple by Merrifield and a double by Kendrys Morales before Salvador Perez's two-run homer made it 4-0. It was the first time the Royals' first four hitters combined for a cycle since Sept. 30, 2006, also at Detroit.
Tigers starter Matt Boyd (6-5) lasted only one more hitter after Perez's homer, giving up another hit before being pulled. The Tigers fell 1½ games behind Baltimore for the second wild-card spot. The loss cut Cleveland's magic number to clinch the AL Central to one - the Indians start a four-game series in Detroit on Monday night.
Boyd said he understood "100 percent" why he was taken out so quickly.
"I might have been able to work myself through it, but the margin of error is zero right now," he said. "Every run is important right now and so is every game."
The Royals led 7-0 after Cheslor Cuthbert and Raul Mondesi hit consecutive homers in the third.
Dillon Gee (8-9) got the win in relief, and Wade Davis pitched the ninth for his 26th save in 29 chances. Miguel Cabrera came up as the tying run but lined out to shallow left field to end it.
Plate umpire Dan Iassogna ejected Cameron Maybin from the Detroit dugout during that final at-bat.
Victor Martinez hit a grand slam for Detroit in the third to make it 7-4, and the Tigers loaded the bases again that inning, chasing starter Edinson Volquez in the process. But Andrew Romine's bunt attempt with two outs was fielded easily by reliever Peter Moylan, and the force at home ended the inning.
Detroit tried several former starters in long relief - Anibal Sanchez, Shane Greene and Mike Pelfrey all pitched - in an attempt to keep the game close, but the Royals kept adding runs. Alex Gordon's two-run homer in the sixth made it 11-5.
Kansas City let the Tigers creep back into it by the end. Justin Upton hit a solo homer in the seventh, and Detroit also scored two runs on wild pitches, the second of which made it 11-9 in the eighth.
The Royals held on, though, and there's still a mathematical chance they can catch the Orioles.
Maybin had four hits for the Tigers.
Merrifield played first base for the first time this season. He's also played second, third, left field and right field.
"It's always fun to switch up the angles for me, see the ball from a different perspective," he said. "I got a couple balls. I didn't get to pick one."
The 3-hour, 51-minute game was Detroit's longest nine-inning contest of the season. The Tigers played 3:50 against the Royals on Saturday.
Tigers: RHP Jordan Zimmermann, who has been dropped from the rotation as he struggles to come back from neck problems, pitched for the first time since Sept. 10. He pitched the last three innings in relief, allowing one run and four hits.
Royals: After an off day Monday, Kansas City starts RHP Ian Kennedy (11-10) against Minnesota RHP Jose Berrios (2-7) on Tuesday night.
Tigers: Detroit sends RHP Buck Farmer (0-0) to the mound Monday against Cleveland RHP Corey Kluber (18-9).