Yadier Molina and Pujols, who will retire at the end of the season, were honored in a 46-minute ceremony prior to their last regular-season home game. Pujols called it ''pretty awesome'' and ''a great day.''
''I'm really blessed to be back here,'' said Pujols, who has 468 homers with the Cardinals. ''To finish my career where everything started, it means a lot.''
Ben Gamel and Bryan Reynolds homered for Pittsburgh, which has won four of six. Reliever Chase DeJong (6-2) got the win for the Pirates, allowing one run on four hits over 1 2/3 innings. David Bednar recorded his 19th save in 23 opportunities.
Reynolds snapped an 0-for-16 skid with his 27th homer of the season.
''I was really proud of our guys, we battled back,'' Pittsburgh manager Derek Shelton said.
Pujols ripped a two-run double in the opening inning, and Molina brought him in with a fly to left for a 3-0 lead.
''He continues to just wow everybody,'' St. Louis manager Oliver Marmol said. ''That was no different.''
The 42-year-old Pujols followed with his 23rd home run of the season in the third inning, a 409-foot drive off Roansy Contreras that tied the game at 4. Pujols is fourth on the all-time home run list behind Babe Ruth (714), Hank Aaron (755) and Barry Bonds (762).
He's also now tied with Ruth for second in RBI (2,214) behind Aaron (2,297).
Molina and pitcher Adam Wainwright started their 328th game together. Wainwright (11-12) allowed six runs on six hits over 4 2/3 innings.
Molina, Pujols and Wainwright were all removed from the game together so they could walk off as a trio with two outs in the fifth. Wainwright has yet to decide if he will come back next season.
''Great emotional day for me,'' Molina said. ''Just to walk with Albert, Waino, it was a great moment for baseball.''
Marmol planned it: ''We wanted all three of them to walk off together. Not a bad way to go out.''
Pujols began his career with St. Louis in 2001 and left for the Los Angeles Angels in 2012. He signed a free-agent contract with the Cardinals on March 28.
The Cardinals, who already clinched their fifth NL Central title in the last 10 years, closed the regular-season with 26 wins in their last 34 home games.
Pujols and Molina were given gifts from the team, including a set of golf clubs, a silver plate and one-of-a-kind artist drawings of each player. The city of St. Louis is also honoring them with a day: Oct. 4 for Molina and Oct. 5 for Pujols.
The two have a combined 41 years in the majors. Former teammates Matt Holiday, Ray Lankord and Jason Isringhausen were present for the ceremony.
Hall of Fame sportswriter Rick Hummel worked his last home game. Hummel, who has covered the Cardinals for the last 51 years for the St. Louis Post-Dispatch, is retiring after this season.
The 76-year-old Hummel has covered 42 All-Star games and 35 World Series.
The Pirates have 11 players under the age of 25 on their roster. The average of the 28-player team is 25.8.
Pirates: C Tyler Heineman was activated from the 7-day Injured List list before the game. C/INF Zack Collins was placed on the 10-day Injured List with a non-COVID illness.
RHP Mitch Keller (5-12, 3.92) will start against the Cardinals in the opener of a three-game series on Monday in Pittsburgh. Keller has allowed three or fewer earned runs in 18 of 21 starts since coming off the disabled list on May 31. The Cardinals have yet to announce a starter.
More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports
Copyright 2022 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.