ST. LOUIS (AP)Albert Pujols hit his 684th homer and Tommy Edman drove in the tiebreaking run with a sacrifice fly in the eighth inning to help the scuffling St. Louis Cardinals beat the Philadelphia Phillies 4-3 on Sunday.

St. Louis had lost two straight and six of seven.

Kyle Schwarber hit his NL-leading 28th homer for the Phillies, who had won three in a row.

Pujols, who singled to start the go-ahead rally in the eighth, has 1,377 extra-base hits to tie Stan Musial for third place on the career list.

”We needed a big game and I was glad it was him,” said Cardinals third baseman Nolan Arenado, who joined Pujols on the NL All-Star team when reserves and pitchers were announced Sunday.

Pujols’ fifth homer of the season was a solo shot in the sixth that brought the Cardinals within 3-2.

”He’s dedicated his life to being great,” St. Louis manager Oliver Marmol said. ”He was locked in today. Righty-lefty, it didn’t matter. He got some pretty good swings. It was fun to watch.”

Pujols unloaded off reliever Cristopher Sanchez, who became the 445th pitcher Pujols has homered against – second-most behind Barry Bonds (449.)

”My job my whole career is to have quality at-bats,” Pujols said. ”I just try to execute and trust the work. Sometimes they go (out), sometimes they don’t.”

Philadelphia outfielder Matt Vierling, who grew up in St. Louis, marveled at Pujols’ longevity.

”It’s special to be competing against him,” Vierling said. ”He’s still got it.”

The Cardinals tied it in the seventh on Nolan Gorman’s groundout.

Edman drove in pinch-runner Dylan Carlson with a short fly to center. Carlson was originally ruled out at the plate, but the call was overturned after a replay review.

Jordan Hicks (2-4) picked up the win with a scoreless inning of relief. All-Star reliever Ryan Helsley got his seventh save.

Matt Vierling broke a 1-all tie with a run-scoring single in the fourth before Schwarber’s homer an inning later put the Phillies in front 3-1.

Cardinals starter Andre Pallante allowed three runs and nine hits over 5 2/3 innings. He struck out four and walked one.

Seranthony Dominguez (4-3) took the loss.

Lars Nootbaar broke the Cardinals’ 19-inning scoreless stretch with an RBI single in the second.

Schwarber scored on a single by Nick Castellanos in the first.

Philadelphia shut out the Cardinals in the three previous meetings.

LOOKING FOR A CHANGE

St. Louis RHP Miles Mikolas decided to burn some sage in the outfield before the game in an effort to change the team’s luck. Mikolas says he deals in holistic medicinal healing and felt the move might help.

OFFENSIVE WOES

The bottom five hitters in the Cardinals’ batting order – Corey Dickerson (.188), Pujols (.198), Lars Nootbaar (.158), Edmundo Sosa (.174) and Austin Romine (.150) – all entered hitting under .200.

TRAINER’S ROOM

Cardinals: INF Brendan Donovan missed his second successive game with an illness. He was not at the game.

UP NEXT

Mikolas (5-7, 2.72 ERA) faces Philadelphia RHP Aaron Nola (5-6, 3.15) in the finale of the four-game series Monday. Mikolas has received zero run support in seven of 17 starts this season. Nola is 5-2 with a 2.19 ERA in eight career starts against St. Louis.

More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports