OAKLAND, Calif. (AP) - Evan Longoria homered early and hit a go-ahead, two-run single in the seventh inning as the San Francisco Giants rallied late again to beat the Oakland Athletics 5-4 on Sunday for a two-game sweep.
Donovan Solano added four hits and an RBI for the Giants in Bruce Bochy's 4,000th game as a major league manager. Buster Posey struck out four times and grounded into a double play.
Mark Canha homered twice for Oakland, both off starter Logan Webb. Canha also struck out with the bases loaded to end the fifth.
The A's remain a half-game behind Tampa Bay for the second AL wild card.
Less than 24 hours after scoring eight times in the eighth inning of a 10-5 win, the Giants fell behind early and trailed 4-3 before loading the bases against Jake Diekman (1-7) with none out in the seventh.
Blake Treinen replaced Diekman and struck out Posey to end an 11-pitch battle. Longoria followed with a first-pitch single to left field that drove in Brandon Crawford and Solano.
Sam Coonrod (4-0) retired three batters to win. Will Smith pitched the ninth for his 30th save.
The Giants appeared to end the game when Josh Phegley singled with two outs and was called out at second base after a throw by center fielder Kevin Pillar. Following a brief review, the call was overturned and Phegley was ruled safe. Smith then got Marcus Semien to ground out.
Earlier in the game, Longoria got his 1,000th career RBI with a solo home run off starter Brett Anderson.
The Giants won three of four against their Bay Area rivals this season.
Neither starter factored in the decision. Anderson allowed six hits and three runs in six innings, while Webb gave up four runs and six hits in 4 2/3 innings.
Canha had an eventful day at the plate and in the field. In addition to his second career multihomer game, he made a terrific catch at the wall in center field but later made a soft throw back to the infield on a sacrifice fly in the second and let Solano's single get past him for an error in the fourth.
Stephen Vogt, who hit a three-run homer as part of the Giants' eight-run eighth inning Saturday night, narrowly missed going deep again twice during the same at-bat in the sixth. Vogt hit a deep fly that curled just outside the left field foul pole, then came up short when Chad Pinder made a leaping grab at the fence.
PROFAR AT DH
Jurickson Profar had a double and two walks as the A's designated hitter. Profar, who began the season as Oakland's starting second baseman, replaced slumping slugger Khris Davis, who grounded out as a pinch-hitter in the ninth and is in a 1-for-29 funk.
HONORING '89 CHAMPS
Members of the A's 1989 World Series championship team were honored during a pregame ceremony. Several members including Hall of Famer Rickey Henderson and manager Tony La Russa attended the event. Dave Stewart, who won two games during the earthquake-interrupted series, threw out the ceremonial first pitch to his former catcher, Terry Steinbach.
Giants: Johnny Cueto will make the first of two rehab starts for Triple-A Sacramento on Monday. Cueto has already made four minor league rehab starts as he works back from Tommy John surgery.
Athletics: C Chris Hermann left with a groin contusion after getting hit below the belt by a bounced pitch. Phegley replaced Hermann. ... Stephen Piscotty is wearing a walking boot on his right foot and it doesn't appear the outfielder will be back in the lineup anytime soon. Piscotty aggravated an ankle sprain during an at-bat Saturday night. "He had an MRI this morning. We're waiting on the results from that," manager Bob Melvin said. "I don't have a great feeling about it at this point but we'll see what the doctors have to say and then proceed accordingly."
Giants: RHP Tyler Beede (3-7, 5.82 ERA) pitches against the Arizona Diamondbacks for the third time this season Monday in San Francisco.
Athletics: Homer Bailey (11-8, 5.06) faces the Royals for the first time in his career Monday at Kauffman Stadium. Bailey began the season with Kansas City before being traded to Oakland on July 14.