Paul Goldschmidt reached base five times, scored twice and hit a two-run homer for the Cardinals, who won for the fourth time in five games.
Esteury Ruiz hit a two-run homer and Seth Brown hit a two-run single for the A's, who lost their fourth straight game and their sixth in seven games.
A's starting pitcher JP Sears allowed three runs on six hits and four walks in five innings. He struck out six. Reliever Angel Felipe (1-1) took the loss after allowing three runs on three walks in one-third of an inning.
Cardinals starting pitcher Miles Mikolas allowed four runs on five hits and three walks in 6 1/3 innings. He fanned four. JoJo Romero (3-1) got the last four outs to earn the victory.
St. Louis catcher Willson Contreras left the game after three innings with right hip tightness.
Goldschmidt, Contreras and Tyler O'Neill walked in the first inning, but Lars Nootbaar lined out to end the inning.
The Cardinals took a 1-0 lead in the second inning. Walker reached on an infield single, stole second and scored on Tommy Edman's single.
Mikolas worked out of third-inning trouble. Shea Langeliers walked leading off and Ruiz reached on catcher's interference with two outs, but Zack Gelof flied out.
Oakland moved ahead 2-1 in the fifth inning when Mikolas hit Nick Allen with a pitch and Ruiz followed with his second homer of the season.
The Cardinals surged ahead 3-2 in the bottom of the inning. Goldschmidt followed Edman's single with his first homer since July 26 and his 19th of the season.
Mikolas dodged trouble again in the sixth inning. Brown hit a single and Brent Rooker walked, but Jordan Diaz hit into a double play and Tyler Soderstrom grounded out.
The A's moved ahead 5-3 in the seventh inning. Lawrence Butler and Allen hit singles off Mikolas, then Gelof hit an RBI double and Brown hit a two-run single against Giovanny Gallegos.
Felipe walked the bases full with one out in the bottom of the inning. Francisco Perez walked Nootbaar to force in a run and allowed Walker's bases-clearing triple.
—Field Level Media