The Royals were trailing 6-4 entering their final at-bat but began a comeback against Jesse Crain (2-2) when Mike Moustakas and David Lough each singled to lead off the frame.
Crain didn't help his own cause when he then mishandled Elliot Johnson's sacrifice bunt try, loading the bases.
The White Sox hurler proceeded to strike out George Kotteras and Jarrod Dyson, but surrendered a walk to Alex Gordon, forcing in a run.
That brought up Alcides Escobar, who sent a grounder to shortstop that Ramirez couldn't field cleanly, allowing Lough and Johnson to score the go-ahead runs.
Luke Hochevar (1-1) got credit for the victory with a scoreless eighth and Greg Holland followed with a 1-2-3 ninth for his 16th save as the Royals avoided a three-game sweep.
Kottaras homered and Gordon drove in two runs for Kansas City.
Adam Dunn blasted a two-run homer en route to four RBI for the White Sox.
Yosemite climber falls 30 feet, suffers major injuries
'How to Train Your Dragon 2' releases 5-minute clip