The Royals' magic number is one, meaning they can reach the playoffs with a victory on Friday night.
"We are getting close to our dream," said winning pitcher Kelvin Herrera.
The Royals also took over sole possession of the American League's first Wild Card spot from Oakland as the A's lost at Texas.
And by winning, the Royals also assured themselves of at least a tie for a Wild Card berth with Seattle. It's an unlikely scenario, but it's possible that the Royals and the Mariners could wind up with the same record and have to settle the tie in a 163rd regular-season game on Monday at Seattle.
Manager Ned Yost, though, is just eager to get back to the ballpark on Friday and win that game.
"I'm anxious," Yost said. "I was really excited today. It's the most excited I've been in a long, long time with the possibility of doing it tonight. But Seattle won that game [at Toronto] so we took care of our business. Oakland lost, so that puts us one up on them. Home-field advantage is real important for us and we're going to come out and take care of business tomorrow."
The Royals pounded out 14 hits with Lorenzo Cain going 4-for-5, Eric Hosmer smacking a home run and even Salvador Perez legging out a triple.
They broke a 3-3 tie in the eighth inning when the White Sox mishandled what appeared to be an inning-ending double play ball by Billy Butler.
There was one out when Cain and Hosmer each singled, ending the outing of White Sox starter Jose Quintana. Reliever Jake Petricka's first pitch was grounded by Butler to shortstop Alexei Ramirez.
In the dugout, Yost figured the inning was over.
"I was already like flushing it," Yost said. "Like, 'OK, we're going to have to get 'em next inning.' Hoz did a great job of busting it down the line [to second base] and we just got lucky right there."
Ramirez's toss forced out Hosmer, but he slid in hard and second baseman Marcus Semien bounced his relay to first base and it couldn't be handled by Jose Abreu, allowing Cain to score.
"I tried to put my head down and run. I made 'em rush and Hoz made a great slide," Butler said. "My job there was to get the ball in the air, but we got in done in an unconventional way."
Terrance Gore ran for Butler, stole second and scored on Alex Gordon's single for a 5-3 lead.
"All game long, we had 'em on the ropes," said Royals starting pitcher James Shields. "We were hitting the ball real well all game long and it was just a matter of time. One thing we've done in the second half is we grind from the first inning to the last inning. We've done a good job of that."
The Royals trailed, 3-2, until Hosmer's home run over the right-field fence against Quintana brought the Royals even in the sixth inning. It was Hosmer's ninth this season and the Royals' first homer in more than a week.
They hadn't gone deep since Cain and Alcides Escobar connected against White Sox ace Chris Sale on Sept. 17 in a 6-2 win at Kansas City.
Shields, who didn't have his best stuff, ran up his pitch count and left after six innings. But the Royals' backend bullpen trio of Herrera, Wade Davis and Greg Holland each worked a scoreless inning. Holland got his 45th save.
"So far, we're three out of four on the road trip and we're going to try to keep it going," Shields said. "We're going to try to create this postseason atmosphere in this clubhouse."
Now, the focus centers on Friday night and, perhaps, a celebration.
"These guys are on fire right now," Yost said. "They know what's going on. They're going to be ready to go."