The Rays and idle Yankees, who have both clinched playoff spots, are even at 94-65 going into the final weekend. Tampa Bay plays three more times at Kansas City while the Yankees have a three-game series at Boston.
If Tampa Bay and New York are tied after Sunday, the Rays win the division title because they won the season series against the Yankees.
Greinke (10-4) gave up two runs and four hits while striking out nine. The 2009 AL Cy Young Award winner with a 16-8 record, Greinke had won only one of his previous seven starts. He'd been tagged for 13 runs and 19 hits in 9 2/3 innings in losing his prior two outings.
"We know what Zack is," Royals manager Ned Yost said. "It makes us all feel better. We want Zack to pitch well and get a win for him. It wouldn't change anything we're trying to do or change any direction we are trying to go if he didn't have a good start, but believe me we much rather have him have the start he had."
Greinke finished with a 4.19 ERA after his last start of the season. He had a 2.16 ERA last year.
"I don't know how I'll look at it in the long run, but right now it wasn't great," Greinke said of his season. "A lot more things could go wrong than they did. It just wasn't great."
Greinke called Jarrod Dyson the player of the game with two superb catches in center.
"I don't remember seeing anyone run after balls like that," Greinke said.
Joakim Soria worked the ninth for his 43rd save, which is a career high, in 45 opportunities. Soria has earned saves in his past 36 opportunities since his last blown save on May 6 at Texas.
Soria has also pitched 23 2/3 consecutive scoreless innings, a Royals record for a relief pitcher, in his past 24 appearances.
Soria was helped by Dyson using his speed to catch a probable extra-base hit by B.J. Upton in the ninth in the ninth with a runner on base.
"Dyson is just flying everywhere in the outfield, two great catches out there to save runs for us," Yost said. "He saved us two runs. It's like driving in two runs."
"Carl hit that bullet and that little center fielder did a nice job," Rays manager Joe Maddon said. "He really covers some ground. He was very impressive. We faced a good pitcher. We are a little schizophrenic offensively. I'm not concerned at all."
Matt Garza (15-10) gave up three runs and five hits in seven innings.
"We've got to win out," Garza said.
The Royals scored a run in each of the first three innings, starting and ending on RBI groundouts by Kila Ka'aihue.
Dyson's triple with two outs in the second brought home Brayan Pena, who had doubled.
"When you got a guy out there throwing like Zack, striking guys out left and right, you want to play good defense behind him and try to put up runs," Dyson said.
Crawford led off the fourth with his 18th home run, matching his career high. Reid Brignac's sacrifice fly in the seventh scored Upton, who doubled and stole his 42nd base.
Rays third baseman Evan Longoria missed his seventh straight game with a strained left quadriceps. ... Royals outfieldr Mitch Maier has not played since Saturday because of stiffness in his left knee. ... Royals first baseman Billy Butler singled in the first inning and has hit in 103 consecutive series, the second such longest streak in the majors. ... If left-hander Bruce Chen picks up his 12th victory Friday in a start against the Rays he would become the first Royals left-hander to win more than 11 games in a season since 1988 when Charlie Leibrandt won 13 and Floyd Bannister won 12.