ST. LOUIS — After a tough eight-game stretch, Chad Pinder is starting to find his hitting stroke.

Pinder and Marcus Semien homered in a six-run fifth inning, and the Oakland Athletics rallied to beat the St. Louis Cardinals 7-3 Tuesday night.

Pinder had three hits Sunday to end a 3-for-23 slump, and kept it going against the Cardinals.

"I was just trying to keep the momentum, not trying to do too much," Pinder said. "I just tried to keep that same approach especially during batting practice today."

Matt Olson also went deep to help Oakland win for the sixth time in eight games.

Tha A's, who had totalled nine runs over their last three games, overcame a 3-1 deficit with the big fifth inning to knock out Cardinals starter Jack Flaherty (4-5).

"He had inconsistent command," St. Louis manager Mike Shildt about Flaherty. "A couple of homers and balls that found holes and balls that were hit hard and it become a big inning."

Josh Phegley opened the inning with a ground-rule double, and Pinder homered to left to tie the score.

"Honestly I went up with the mindset to get a pitch just to move (the runner) over to third, not to do too much," Pinder said. "The first pitch he threw me was a four-seamer and it had a little cut and I was trying to get my timing there and he ended up throwing pretty much the same exact pitch the next pitch and I was able to put a good swing on it. "

Semien followed with his shot to centre to put Oakland ahead 4-3. The A's scored three more runs on three singles — including Stephen Piscotty's run-scoring hit — and pinch-hitter Khris Davis' two-run double off reliever John Brebbia.

"I wasn't able to execute," Flaherty said. "The ball to Pinder, he just put a good swing on it. It got Semien down 0-2 and threw a really bad pitch. I battled with Piscotty and he battled and put a good swing on it. You make mistakes and they found holes."

Flaherty gave up a season-high seven runs and nine hits and a walk in 4 2/3 innings. He gave up three homers to raise his total to nine allowed in five winless June starts. Overall, Flaherty has given up 18 homers in 16 starts this season.

Flaherty has given up five leads of two or more runs this season.

J.B. Wendelken (1-1) picked up his first MLB victory after spending time with Oakland in parts of three seasons. He got the final two outs of the fourth inning and was lifted for a pinch-hitter in the bottom of the fifth.

"(I'm) super excited," Wendelken said. "You get a little jittery every now and then but when you get a win like that it means a lot because the boys stepped up when we were down and that's all you could ask for right there. "

The Athletics went ahead 1-0 in the second when Olson led off with a home run to left field.

The Cardinals went ahead with a three-run second. Matt Carpenter tripled with two outs, driving in Yadier Molina and Kolten Wong. He hit a deep fly to centre and Ramon Laureano fell down after turning the wrong way on the ball. It landed just in front of the wall and Laureano for Carpenter's second triple this season. He scored on a double by Paul DeJong for a 3-1 lead.

Oakland's Chris Bassitt was lifted for a reliever after 3 1/3 innings. It was his shortest stint in his 12 starts this season. He allowed three runs and four hits with four walks.

FOUL BALL

Cardinals RF Jose Martinez fouled off eight consecutive pitches before striking out in a 12-pitch at-bat to end the first inning with two men on base. Bassitt made 34 pitches in the inning.

ROSTER MOVES

The Cardinals recalled RHP Daniel Ponce de Leon and RHP Dominic Leone from Triple-A Memphis on Tuesday. LHP Genesis Cabrera was optioned to the Redbirds.

TRAINER'S ROOM

Athletics: LHP Sean Manaea (shoulder) has been shut down with no timetable on his return. He has soreness on his right side. He threw 60 pitches in a simulated game last Thursday. ... C Chris Herrmann (right knee) will catch back-to-back games in a rehab assignment in Las Vegas before he will be activated from the injured list.

Cardinals: RHP Jordan Hicks (right elbow) has been placed on the 10-day Injured List, retroactive to June 23. ... RHP Alex Reyes (strained pectoral muscle) will miss two to three starts at Triple-A Memphis. The oft-injured Reyes has a 7.39 ERA in 28 innings for the Redbirds this season.

UP NEXT

Athletics: RHP Daniel Mengden (1-1, 5.09) is being recalled from Triple-A Las Vegas for his second stint with the A's this season.

Cardinals: RHP Adam Wainwright (5-6, 4.50) will be making his third career start against Oakland. He won the previous two, going eight innings or more in each game.

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports