San Diego Padres' Trent Grisham, left, runs toward Fernando Tatis...

San Diego Padres' Trent Grisham, left, runs toward Fernando Tatis Jr. (23) after scoring against the San Francisco Giants during the 10th inning of a baseball game in San Francisco, Wednesday, Sept. 27, 2023. Credit: AP/Jeff Chiu

SAN FRANCISCO — Manny Machado hit a two-run single in the 10th inning, and the San Diego Padres beat the San Francisco Giants 5-2 on Wednesday night to keep their slim postseason hopes alive with their first extra-inning win this year.

San Diego had been 0-12 in extra innings and were tied with the expansion 1969 Montreal Expos for the most extra-inning losses in a season without a victory.

“We needed one,” Padres manager Bob Melvin said. “I think more than anything, the reason we did is because we executed today. We had a couple of sac flies. We had some big hits.”

The Padres (79-80) trail the Chicago Cubs and Miami (82-76) by 3 1/2 games for the final NL wild card spot with three games remaining. San Diego is also two games behind Cincinnati (81-78).

San Diego must sweep three games at the Chicago White Sox to have any hope to reach the playoffs while hoping the Cubs and Marlins lose four games each and the Reds drop at least two of their final three.

“We’re going to need some help over the next four days where hopefully a miracle comes,” first baseman Garrett Cooper said. “You’re wishing on a prayer, but you’ve got to take care of business here first.”

The Giants (78-81) were mathematically eliminated Tuesday and lost for the 10th time in 13 games, assuring they won't finish with a winning record. San Francisco was held to five hits.

San Diego Padres catcher Brett Sullivan, left, celebrates with pitcher...

San Diego Padres catcher Brett Sullivan, left, celebrates with pitcher Tom Cosgrove after the Padres defeated the San Francisco Giants in a baseball game in San Francisco, Wednesday, Sept. 27, 2023. The Padres won 5-2 in 10 innings. Credit: AP/Jeff Chiu

Xander Boegarts hit a go-ahead sacrifice fly off John Brebbia (3-4) and the Padres were boosted by shortstop Marco Luciano's throwing error on Fernando Tatis Jr.'s grounder and catcher Patrick Bailey throwing error on a pickoff attempt. All three runs off Brebbia were unearned,

“A little sloppy defense there,” Giants manager Gabe Kapler said. “You just can’t win baseball games that way.”

Josh Hader (2-3) pitched a scoreless ninth for his 20th career win and Tom Cosgrove earned his first big league save.

Thairo Estrada put the Giants ahead in the second inning with his 14th homer this season, matching a career-high set last year.

San Diego Padres' Fernando Tatis Jr. (23) reaches first base...

San Diego Padres' Fernando Tatis Jr. (23) reaches first base as San Francisco Giants first baseman Wilmer Flores looks for the ball on a throwing error by shortstop Marco Luciano during the 10th inning of a baseball game in San Francisco, Wednesday, Sept. 27, 2023. Tatis advanced to second. Credit: AP/Jeff Chiu

Bogaerts hit a sacrifice fly in the fifth to tie the game at 1, but Tyler Fitzgerald had a broken-bat RBI single in the bottom half. Cooper tied it again in the seventh with his 17th home run.

FOR STARTERS

Giants starter Sean Manaea allowed two runs in six innings, striking out eight. The left-hander surpassed 1,000 innings, finishing the night at 1,002 2/3.

Padres right-hander Matt Waldron also allowed two runs in six innings with two strikeouts and two walks.

TRAINER’S ROOM

Padres: C Luis Campusano missed his third straight game after jamming his right ankle in Sunday’s win against the Cardinals. Campusano was in uniform and Melvin was hopeful he could have entered the game if needed.

Giants: 3B J.D. Davis was held out of the lineup after spraining his left shoulder on a slide in the first inning of Tuesday’s game. Kapler doesn’t expect him to go on the injured list. “Obviously, we’ll keep checking him, but as of this moment, we don’t have that plan,” he said. ... LHP Kyle Harrison, who was scratched from Tuesday’s scheduled start due to illness, is expected to make a start this weekend against the Dodgers. ... RHP Keaton Winn, on the COVID-19 IL since Sept. 19, could also return next series.

UP NEXT

Padres: RHP Nick Martinez (5-4, 3.59 ERA) opens the series Friday, with RHP Dylan Cease (7-8, 4.66) starting for the White Sox.

Giants: Close with a three-game home series against the Los Angeles Dodgers beginning Friday night.

More MLB news

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME