''We were able to break through,'' said St. Louis manager Mike Shildt, who picked up his 200th career win.
St. Louis had lost six of seven before beating the team with baseball's worst record. The Diamondbacks, who have won just once on the road since April 25, have lost 22 of 24 overall.
It was 1-all when Edmundo Sosa opened the St. Louis seventh with a double off reliever Alex Young (2-6) and moved up on a sacrifice. Dylan Carlson hit a line drive just out of the reach of drawn-in second baseman Eduardo Escobar for a go-ahead single.
''I shortened up and got the job done,'' Carlson said. ''To get rewarded is really nice. We'd like to see that keep going. Hopefully it keeps rolling. It was a great inning for us. We're all just trying to get the job done.''
Paul Goldschmidt added an RBI single, Yadier Molina hit a two-run double with two outs and DeJong followed with a two-run homer.
Giovanny Gallegos (5-1), the fifth of seven Cardinal pitchers, went one inning.
''I don't think too much. I stay in the moment,'' Gallegos said '' I try to get the hitters out and help the team win games.''
Carlson hit an RBI triple in the third for 1-0 lead. Right fielder Pavin Smith tried to make a diving catch on the ball and it rolled to the wall for Carlson's third triple this season.
''He's continued to take good at-bats. He's a guy who plays the game a little beyond his years,'' Shildt said. ''He understands what is called for. He's a player with great awareness. He doesn't give at-bats away.''
The Diamondbacks tied it when Josh Rojas homered in the fifth to chase Wade LeBlanc.
The 36-year-old LeBlanc pitched 4 1/3 innings in making his first National League start since 2013 when he was with Miami. He took the rotation spot of John Gant, who was moved to the bullpen.
''Be aggressive and throw strikes and get the offense back out there to swing some sticks,'' LeBlanc said. ''I was prepared to go until they took the ball from me.''
HIT BY PITCH
LeBlanc hit a batter in the first inning. That increased St. Louis' MLB-leading total to 57. The Cubs are a distant second with 45.
Diamondbacks: Recalled RHP Humberto Castellanos from Triple-A Reno. The rookie has made five appearances this season, posting a 3.24 ERA and striking out eight in 8 1/3 innings.
Cardinals: Selected the contract of rookie RHP Roel Ramirez from Triple-A Memphis and recalled rookie LHP Brandon Waddell from Memphis. The team also optioned pitchers Seth Elledge and Jake Woodford to Memphis and designated first baseman John Nogowski for assignment. Waddell made his MLB debut by pitching in the ninth inning. After giving up a leadoff walk, he retired the side.
Diamondbacks: OF/INF Ketel Marte (strained left hamstring) was placed on 10-day injured list retro to June 27. The 27-year-old Marte also was on the injured list from April 8-May 18 with a right hamstring strain.
Cardinals: CF Harrison Bader (right rib hairline fracture) is headed to Memphis for the next step of his rehab assignment. After playing at Low-A Palm Beach, Bader came back to St. Louis and had a re-evaluation Monday. Bader is likely to return sometime this week. ... Reliever Kodi Whitley (back spasms) will begin a rehab assignment with Springfield on Tuesday.
Diamondbacks: LHP Caleb Smith (2-3, 3.03) allowed one run in six innings in his last start against Milwaukee. He made a relief appearance against St. Louis on May 26 and allowed no earned runs in 2 1/3 innings.
Cardinals: RHP Carlos Martinez (3-9, 6.78), who has a five-game losing streak, is 3-1 with a 2.76 ERA in seven career starts against the Diamondbacks.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.