The left fielder finished the night a single shy of the cycle, matching a career high with five RBIs.
He also gunned down a pair of runners at the plate -- both in the second inning.
"He had really been struggling," A's manager Bob Melvin said. "Then, when we needed him, he steps up."
With the score tied, 3-3, in the seventh, Cespedes roped a two-out, two-run triple to right off reliever Joe Smith to give Oakland the lead for good.
"I got him on a fastball away in the past," Smith said. "Tried to get another one in there and I missed my spot bad. It was a stupid pitch. I should've stayed in there or gone to a slider or something, either one. Instead I shook him off, and it wasn't the smart thing to do."
Cespedes followed with a three-run homer in the eighth, putting the finishing touches on a night when the A's scored 11 unanswered runs, 10 of which came in their final two turns at bat.
Melvin suggested that the festive atmosphere, with a large crowd on hand to celebrate the 40th anniversary of the A's 1974 World Series championship team, helped put an extra jolt into Cespedes. The slugger agreed.
"I've got a lot of motivation when I see the field like that, the stands full," Cespedes said through a translator. "Same thing in the playoffs -- it was so loud ... and it gave me a lot of motivation to do my best for the team."
The A's trailed, 3-0, after Tommy Milone surrendered a three-run homer to Collin Cowgill in the fourth, and they had few answers for southpaw Tyler Skaggs over the first six innings.
But Kyle Blanks led off the seventh with a homer off Skaggs to make it 3-2. Then, with the bases loaded and one out against Smith, Josh Donaldson grounded out to second to drive in the tying run.
Cespedes followed with his two-run triple, and two batters later, Alberto Callaspo brought in two more with a double down the right-field line. Craig Gentry singled home Coco Crisp in the eighth before Cespedes' homer.
"It's better that we did it later in the game than not at all," Milone said of the offense. "We know what it's capable of, and they came out tonight."
But long before the A's bats came alive, Cespedes' rocket throws to the plate helped swing momentum in Oakland's favor.
"Defensive plays can be momentum shifts as much as a home run or a big hit," Melvin said. "The way things were going, they were squaring Tommy up pretty good, and we felt pretty fortunate -- you look up there, in the first two innings there were six hits and no runs. So it was a huge momentum shift for us to still be in that game. It felt like we should have been down five or six to nothing."
Instead, the lefty escaped after six innings with only three runs to his name.
The A's improved to 4-2 during their seven-game homestand, which concludes Sunday afternoon when they go for the sweep against the Angels.
They increased their Major League-leading run differential to plus-112.