The Cespedes blast against Shawn Kelley (2-4) broke a 2-2 deadlock.
Oakland added some insurance later in the frame when Josh Reddick connected for a two-run shot and the A's drew closer to their first playoff berth in six years with their 15th win in 20 home games.
The rally made a winner of Sean Doolittle (2-1) and Grant Balfour collected his 22nd save of the season for Oakland, which came into the contest two games ahead of the Los Angeles Angels for the second American League wild card spot.
They also pulled to within 1 1/2 games of the Texas Rangers for the AL West lead with the triumph.
Kyle Seager and Justin Smoak each drove in a run for Seattle.
2014: The Year in Fashion [PHOTOS]
LeBron James reveals his new Nike shoes