A solo blast from Coco Crisp in the sixth put Oakland in front for good, keeping the A's a game in front of Texas at the top of the American League West.
Cespedes hit a two-run homer in the first and added another in the ninth, giving him 15 for the season. Jed Lowrie also had a solo shot in the fourth that lifted the Athletics into a 3-3 tie.
The Seattle runs came on a three-run homer by Nick Franklin in the third.
Balfor allowed a single and struck out two to register his 18th save.
Hisashi Iwakuma (7-3) took the loss, giving up four runs on six hits in seven innings.