Kyle Schwarber hit his 25th home run and finished the game with a sacrifice fly in the 12th inning, giving the Philadelphia Phillies a 7-6 win over the San Diego Padres on Sunday.

The defending National League champions won three straight games over the Padres following a three-game losing streak, including a series-opening loss to San Diego to start the second half. The Padres, who lost in the NLCS to the Phillies last fall, fell to 44-50, including 19-27 on the road.

Philadelphia (51-42) overcame a 3-0 deficit and then blew a 5-3 lead when pinch-hitter Fernando Tatis Jr. hit a two-run single in the eighth off Gregory Soto. Juan Soto hit a sacrifice fly in the tenth off Matt Strahm, but Bryce Harper hit a two-out single off Josh Hader in the bottom half.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Philadelphia Phillies’ Kyle Schwarber celebrates with teammates after hitting a RBI-winning sacrifice fly against San Diego Padres relief pitcher Tim Hill during the 12th inning of a game baseball game on Sunday, July 16, 2023, in Philadelphia. (AP Photo/Matt Slocum)

«A really good pitcher and a really good hitter, and Harp made the best of things this round,» Phillies starter Zack Wheeler said. «It’s what you expect from your big guy.»

With automatic runner Edmundo Sosa at second starting at the 12th, Johan Rojas sacrificed himself against lefty Tim Hill (1-4) and Schwarber hit a 304-foot fly ball to Soto to left. Sosa slid to the plate easily before Soto’s pitch.

Jeff Hoffman (3-1) retired six straight batters in the 11th and 12th innings, stranding automatic runners both times.

«It was big for us,» Wheeler said. «It’s very hard not to let them score there, especially when a guy reaches third with one out. Really hard.»

San Diego manager Bob Melvin was ejected in the 12th by crew chief Dan Bellino following a shot clock violation penalty, Melvin’s fifth ejection this season and the 59th of his managerial career.

CARDENALS’ JACK FLAHERTY WINS FOURTH CONTINUOUS MATCH WITH VICTORY OVER NATIONALS

Bryce Harper reacts

Bryce Harper of the Philadelphia Phillies reacts after hitting a run-scoring single during the 10th inning of a baseball game against the San Diego Padres, Sunday, July 16, 2023, in Philadelphia. (AP Photo/Matt Slocum)

«I thought we were going to pull a ‘W’ tonight. We played great defense. We had some good at-bats, but we couldn’t finish it,» Padres starter Seth Lugo said. «Something they’re good at is not missing mistakes, and I made a couple of mistakes and paid the price for it.»

Wheeler allowed three runs and five hits in seven innings with seven strikeouts and no walks.

Ha-Seong Kim and Xander Bogaerts built an early lead as they each hit their 11th home run, Kim hitting his first and Bogaerts his fourth. Trent Grisham made it 3-0 with an RBI double in the fifth.

Bryson Stott homered in the bottom half and Schwarber went deep to generate a four-run sixth. JT Realmuto’s two-run double chased Lugo and Drew Ellis walked Tom Cosgrove with the bases loaded.

GUARDIANS’ SHANE BIEBER CANNOT PITCH FOR TWO WEEKS DUE TO SWOLLEN ELBOW

Bob Melvin argues call

Bob Melvin of the San Diego Padres discusses a chant during the 12th inning of a baseball game against the Philadelphia Phillies, Sunday, July 16, 2023, in Philadelphia. (AP Photo/Matt Slocum)

«I tried to stay focused as a club, knowing that today was big,» Harper said. «To be able to win the series against them… I thought we played great baseball. I thought we hit some hard balls in those first few innings, and they made some good plays. They jumped on us, then we came back, come back, and we went to innings extra and we go from one place to another».

BRYCE ON THE FIELD

Phillies manager Rob Thomson said Harper will likely play his first major league game at first base this week, his first time on the field since Tommy John surgery last November. Harper has been a designated and pinch hitter since his return on May 2.

COACHES ROOM

Padres: LHP Adrián Morejón was placed on the 15-day disabled list with inflammation in his right knee.

Phillies: OF Cristian Pache will undergo surgery on his right elbow to reinsert a screw from an operation prior to the start of his career in 2015 that has turned problematic. Thomson said the procedure will put Pache out of action for «weeks, but not months.»

CLICK HERE TO GET THE FOX NEWS APP

Kyle Schwarber celebrates with Alec Bohm

Philadelphia Phillies Kyle Schwarber, right, celebrates with Alec Bohm, center, and Gregory Soto after hitting a game-winning RBI sacrifice fly against San Diego Padres reliever Tim Hill during the inning 12 of a baseball game, Sunday, July 16, 2023., in Philadelphia. (AP Photo/Matt Slocum)

UNTIL NEXT TIME

Phillies: RHP Aaron Nola (8-6, 4.39) starts Tuesday’s series opener against visiting Milwaukee and RHP Julio Tehran (2-3, 3.64).

Padres: RHP Joe Musgrove (8-2, 3.29 ERA) starts Tuesday’s series opener at Toronto, pitching RHP Alek Manoah (2-7, 5.91 ERA).