Guillermo Quiroz hit a three-run home run of his own for the Giants, who still won five of their last seven games.
Straily pitched five shutout innings to earn the victory for the A's, who were 8-1-1 over their final 10 games. He allowed six hits, struck out five and did not walk a batter.
"He looked like he was a lot more aggressive with his fastball," A's manager Bob Melvin said. "That's the best he's looked all spring."
Straily's effort came at a good time, as there remains some question whether he will stay in the rotation when Bartolo Colon, who threw four innings in relief, becomes eligible next Saturday.
"Five zeros, that was real good," Straily said. "I was able to just finish innings, something I haven't been able to get through yet this spring. It was really good to finish on that note."
Ryan Vogelsong, meanwhile, allowed four runs on six hits over five innings for the Giants. He walked one and struck out two.
"I was kind of out of whack," Vogelsong said. "I felt better the last two innings, but it took me too long to figure out what I was doing wrong. Just kind of hit one pitch, missed one. I couldn't really put a finger on what I was doing wrong until about the fourth inning."
Josh Reddick also drove in a run for the A's and Coco Crisp had two hits.
Brandon Crawford singled in the fourth, extending his hitting streak to 12 games. Marco Scutaro and Joaquin Arias each added two hits and Angel Pagan had a triple.
Cespedes hit all six of his home runs and drove in 13 runs over his last 11 games.
In things you'll only see during Spring Training, Giants long reliever Chad Gaudin, a lifetime .025 (1-for-40) hitter, pinch-hit for reigning National League MVP Buster Posey. He struck out.
Travis Blackley, whom the A's designated for assignment Friday, attended Saturday's game as a fan. He spent a few innings among the spectators in the right-field bleachers.