PITTSBURGH (AP) — Jack Flaherty cruised through six innings, Matt Carpenter hit another homer and the St. Louis Cardinals held on for a 2-1 victory over the Pittsburgh Pirates on Sunday.

Completing six innings for the first time since July 3, Flaherty (5-6) allowed three hits with seven strikeouts and one walk.

Carpenter hit a solo home run in the fifth and Jedd Gyorko singled to drive in a run later that inning to give the Cardinals a 2-0 lead.

St. Louis took the final two games of the three-game series against Pittsburgh to move past the Pirates into third alone in the National League Central.

Bud Norris retired the side in order with two strikeouts in the ninth for his 21st save.

Flaherty recovered after giving up four runs on five hits in 5 1/3 innings of a 6-3 loss to the Colorado Rockies in his last start.

He got out of trouble twice on Sunday, first when the Pirates had runners on second and third with one out. Corey Dickerson struck out and Starling Marte grounded out to end the third inning. With runners on first and third two innings later, Flaherty forced Jordan Luplow into an inning-ending double play.

Carpenter's home run, his career-high 29th of the season, to right with one out in the fifth ended Trevor Williams' streak of 21½ innings without allowing a run. That stretched back to July 6, when Williams (9-8) gave up three runs in the third inning of a 17-5 loss to the Philadelphia Phillies.

After the homer, Williams surrendered consecutive singles to Yadier Molina and Jose Martinez before Gyorko scored Molina with a single to left. Williams allowed those two runs on nine hits with three strikeouts in five innings.

Adam Frazier hit a home run off reliever Chasen Shreve to make it 2-1 in the seventh.

ROSTER MOVES

Cardinals: RHP Tyson Ross was claimed off waivers from the San Diego Padres, and will join St. Louis in Miami. He was 6-9 with a 4.45 ERA and 107 strikeouts in 22 starts for the Padres this season.

Pirates: RHP Casey Sadler was recalled from Triple-A Indianapolis. RHP Alex McRae, who allowed three runs on five hits in 3 1/3 innings of relief Saturday, was optioned to Indianapolis.

TRAINER'S ROOM

Pirates: Dickerson started in left field for the first time since missing eight games with left hamstring discomfort. He hit leadoff and was 0 for 3 with one walk.

UP NEXT

Cardinals: RHP Luke Weaver (6-9, 4.75) will attempt to keep his string of impressive performances going when he faces the Miami Marlins on Monday. He has surrendered three runs or fewer in five straight starts since giving up eight in an 11-4 loss to the Atlanta Braves on June 30.

Pirates: RHP Joe Musgrove (4-5, 3.63) will look for a third straight quality start when he takes the mound against the Rockies on Monday. In his last two starts, Musgrove has allowed three combined runs on 10 hits in 14 innings.

___

More AP baseball: https://apnews.com/tag/MLBbaseball