The A's were trailing 3-2 in the seventh when Derek Norris lined what appeared to be a single to center field, but the ball hopped over the glove of David Lough and rolled all the way to the fence for a two-base error.
Norris went on to score the tying run on Coco Crisp's sacrifice fly.
Then with Kelvin Herrera (2-4) on the mound, Cespedes led off the eighth with a shot that cleared the left-center field wall for the decisive blow.
Jerry Blevens (3-0) earned the win with a scoreless eighth and Ryan Cook earned his first save despite allowing two hits in the ninth as Oakland completed a three-game sweep of the Royals.
Celebrity Couples of 2014 [PHOTOS]