ST. LOUIS -- Adam Wainwright made the most of a couple of extra days of rest.
Wainwright (6-7), who was scratched from Friday's start due to back spasms, relied on a mixture of cutters, change-ups and curve balls. He allowed four hits, walked one and struck out seven as he improved 4-0 in day starts this season.
"There's still some things I can do better, a few 2-0 counts that I had today that I would like to avoid to some pretty good hitters," Wainwright said. "They had first and third a couple of times, we got out of it with a couple good pitches that we needed to make. Other than that, I'm throwing the ball like I expect to throw the ball."
Arizona trailed 5-0 going to the ninth before Domingo Leyba and Jarrod Dyson had RBI singles against John Brebbia. The Diamondbacks had the bases loaded with two outs, but Carlos Martinez got Eduardo Escobar to hit a fly ball to center for the final out for his fifth save.
"It's exactly the game were looking for," Cardinals manager Mike Shildt said. "It's exactly the game we've demonstrating. It gets punctuated with the run production, simple as that."
Wainwright helped himself out offensively by walking and scoring to start a three-run third inning rally and he also laid down a sacrifice bunt leading to Matt Carpenter's sacrifice fly as the Cardinals tacked on their fifth run in the fourth.
The 37-year-old and 3-time All-Star had some extra motivation facing Diamondbacks starter Zack Greinke, who beat Wainwright in the only two games the standout hurlers faced each other in 2012 and 2013.
"My first focus is winning a game against that team first, but especially against beating Zack because he's such a great competitor, a great pitcher," Wainwright said. "I wanted to get him on my list. I know I'm on his list."
Goldschmidt's 416-foot two-run shot into the upper deck in left field gave the Cardinals a 4-0 lead in the third. Yairo Munoz started the rally with a single that drove in Wainwright, and advanced to third on Nick Ahmed's throwing error.
It was Goldschmidt's first career home run off of Greinke.
"He can throw any pitch at any time so as a hitter you can't guess, just try to react," Goldschmidt said. "Luckily I was able to get a couple of hits."
Tyler O'Neill continued his RBI barrage by driving home Goldschmidt with a double that hugged the left field line to make it 1-0 in the first inning, ending Greinke's 14-inning scoreless streak. O'Neill drove in all four Cardinals run in a 4-2 win on Saturday night.
Greinke (10-4) gave up five runs in six innings. The loss snapped a five-year July winning streak for the Arizona ace, who entered the game 14-0 with a 1.34 ERA in his last 18 starts in the month dating back to July 25, 2014.
"It's a game of inches," Greinke said. "Made some mistakes at the wrong times, some critical moments and they capitalized."
Diamondbacks: RHP Taylor Clarke (lower black inflammation) threw 70 pitches over six scoreless innings at High-A Visalia on Saturday. ... INF Wilmer Flores (fractured right foot) will continue his rehab at Triple-A Reno and could rejoin the team on its next home stand. ... RHP Jon Duplantier (right shoulder inflammation) gave up two runs in an inning for the Arizona Rookie League D-Backs on Saturday.
Cardinals: INF Jedd Gyorko (right wrist surgery) will be re-evaluated in a month.
Diamondbacks: LHP Alex Young (2-0, 0.68 ERA) will take the mound to begin a two-game set at Texas and RHP Lance Lynn (12-4, 3.69 ERA) on Tuesday night. Young, who will be making his third career start, threw six scoreless innings in a 5-3 win over Colorado on July 7.
Cardinals: RHP Miles Mikolas (5-9, 4.53 ERA) will get the start to kick off a three-game series against Pittsburgh and RHP Joe Musgrove (6-7, 4.15 ERA) on Monday night. Mikolas is 2/3 with a 2.96 ERA in nine career appearances against the Pirates.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Baseball's quietest man will be the reason for many Hall of Fame speeches
Last winter's surprise selection of Harold Baines could blow the doors to Cooperstown wide open Sunday night -- and beyond.
Royals sign former All-Star Trevor Rosenthal to minor league deal
The Kansas City Royals signed former All-Star reliever Trevor Rosenthal to a $2 million minor league contract that includes an invitation to big league spring training and up to $2.25 million in bonuses if he makes the major league roster.
Yankees GM rappels building, gets fan's message on Gerrit Cole
Brian Cashman saw a message taped to a 10th-floor window while prepping for a festival in Connecticut. "Please sign Gerrit Cole," it said. The GM's response: "I'm open to do clearly whatever, as always, is important for the Yankees."
Rays' Blake Snell strongly reacts to Tommy Pham trade on Twitch
Rays pitcher Blake Snell apologized for his reaction -- captured during a livestream on Twitch -- to news that teammate Tommy Pham was traded to San Diego.
What's next for the teams that lose the Gerrit Cole sweepstakes?
One team will land the best pitcher on the planet. The rest of his suitors? They'll have to scramble.
Source: Nationals agree to deal with World Series hero Howie Kendrick
Howie Kendrick, who capped the Nationals' improbable run to their first World Series title last season with a Game 7 home run, has reached an agreement on a one-year, $6.25 million deal to return to Washington, a source told ESPN's Jeff Passan on Friday.