Giants rally behind Longoria to edge Athletics 5-4

OAKLAND, Calif. -- After standing in the on-deck circle and watching an 11-pitch tussle between Buster Posey and Athletics reliever Blake Treinen that ended in a strikeout, Giants cleanup hitter Evan Longoria decided to take a quicker approach in his own at-bat against the former All-Star closer.

"I don't know if I swung at a first pitch this whole series but I kind of thought if this is the time, this is going to be it," Longoria said. "I figured (Treinen) was going to try and get ahead."

Longoria hit a go-ahead, two-run single off Treinen in the seventh inning after homering earlier in the game, and San Francisco rallied late again to beat Oakland 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.

"What a great job they did here, the way they fought," Bochy said. "Another good comeback. These two games could have gone either way."

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.

Treinen replaced Diekman and struck out Posey to end their long battle. Longoria followed with a first-pitch single past shortstop Marcus Semien that drove in Brandon Crawford and Solano.

"I was staring at the 6-hole and really telling myself not to get around it, just see it up and get it close to me," Longoria said.

Treinen was happy with his pitch, if not the result.

"I got a groundball," he said. "I can't control where it goes."

Sam Coonrod (4-0) retired three batters and Will Smith pitched the ninth for his 30th save.

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.

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 Semien to ground out.

Earlier in the game, Longoria got his 1,000th career RBI with a solo home run off starter Brett Anderson.

"I've been thinking about it for a while," Longoria said. "It's a proud moment."

The Giants won three of four against their Bay Area rivals this season.

STARTING OFF

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'S DAY

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.

"We've seen him good here before when given the opportunities and the at-bats, but I don't know that he's ever been this good," A's manager Bob Melvin said.

NEAR MISS

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

The A's saluted their 1989 World Series championship team 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 against the Giants, threw out the ceremonial first pitch to his former catcher, Terry Steinbach.

TRAINER'S ROOM

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. . OF Mike Yastrzemski exited with a bruised left hand.

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 headed for the injured list because of a high ankle sprain he aggravated during an at-bat Saturday. Piscotty wore a walking boot on his right foot Sunday and did not play.

UP NEXT

Giants: RHP Tyler Beede (3-7, 5.82 ERA) pitches against Arizona for the third time this season Monday in San Francisco.

Athletics: RHP 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.

---

More AP MLB:https://apnews.com/tag/MLB andhttps://twitter.com/AP-Sports