PITTSBURGH (AP) — Miguel Andújar had three hits, Diego Castillo added two and the Pittsburgh Pirates beat the playoff-bound St. Louis Cardinals 5-3 on Wednesday in the regular season finale.

Kevin Newman, Rodolfo Castro and Ji Hwan Bae drove in runs for Pittsburgh. Manny Banuelos (2-1) picked up the win in relief and Johan Ramirez worked the ninth for his second save of the season — first with the Pirates.

Pittsburgh finished 62-100, a one-victory improvement over 2021. This is the first time since the 1950s that the Pirates have posted consecutive 100-loss seasons.

St. Louis finished 93-69, a three-game improvement from 2021 (90-72), while cruising to its first NL Central title since 2019. The Cardinals reached the playoffs for the fourth straight year and will host Philadelphia in the best-of-three wild-card round starting on Friday at Busch Stadium.

Tommy Edman had three of St. Louis’ eight hits. Matthew Liberatore (2-2), recalled from Triple-A Memphis earlier in the day, took the loss after allowing five runs in five innings.

The Cardinals gave Albert Pujols the day off to rest up for the playoffs. Pujols finished his 22-year career with 703 home runs (fourth all-time), 2,218 RBIs (second all-time), 6,211 total bases (second all-time) and 3,384 hits (10th-all-time).

St. Louis catcher Yadier Molina, who like Pujols is retiring, lined out to second as a pinch hitter in the seventh in his 2,224th and final regular season game.

The Cardinals took a 3-0 lead in the third on Edman’s RBI-double but the Pirates jumped ahead with a four-run fourth that started with a double by Andújar, brought over from the New York Yankees earlier this month.

TRAINER’S ROOM

Cardinals: Activated RHP Jordan Hicks off the injured list after he missed 18 games with right arm fatigue. Hicks allowed two hits in a scoreless sixth inning.

Pirates: C Roberto Perez, who missed most of the season with a hamstring injury, is expected to be cleared to return to baseball activities on Nov. 4. Perez will be a free agent this winter but has said he wants to return to Pittsburgh.

ATTENDANCE DIP

The first regular-season finale since 2007 between the two longtime division rivals brought 15,319 to PNC Park. The Pirates averaged 15,524 fans in 81 home dates this season, down from 18,412 in 2019, the last full season that did not have COVID-19 pandemic restrictions.

UP NEXT

St. Louis: will try to advance in the playoffs for the first time since 2019, when they reached the NL Championship Series before getting swept by Washington.

Pittsburgh: Start Grapefruit League play on Feb. 25 against Toronto.

By WILL GRAVES, AP Sports Writer