Chicago overcame a three-run deficit to get the score tied in the seventh and it remained deadlocked until Gillaspie launched a homer to right on an 0-1 pitch leading off the 13th against Luke Hochevar (3-2).
Addison Reed came on in the bottom half of the inning and walked Billy Butler to open the inning. Jarrod Dyson pinch ran for Butler and stole second, but he was stranded there when Reed retired the next three batters for his 34th save.
Reed has saved all but 18 of Chicago's wins this season.
The victory was picked up by Jake Petricka (1-0) in what was his major league debut. Petricka, a recent call-up from Class AAA Charlotte, came in with two on and one out in the 11th inning and escaped the jam by getting Salvador Perez to ground into a double play.