ST. LOUIS (AP) -- Lance Lynn threw six strong innings and Jose Martinez homered and drove in three runs as the St. Louis Cardinals beat the Arizona Diamondbacks 3-2 Sunday for their fifth win in seven games.
Lynn (9-6), the subject of trade rumors the past few days, gave up two runs and four hits. He has allowed no more than two earned runs in each of his last six starts.
Lynn retired the last eight batters he faced in improving to 5-0 lifetime against Arizona. Trevor Rosenthal struck out the side in the ninth to pick up his sixth save in eight opportunities.
Martinez hit a two-run drive in the fourth to tie it, then had a sacrifice fly in the sixth that scored Jedd Gyorko with the go-ahead run.
Taijuan Walker (6-5) allowed three runs on four hits over 5 2/3 innings. He struck out 10.
Arizona, in prime position for an NL wild-card spot, is 2-2 on its 10-game road trip.
Yadier Molina singled Gyorko to third base in the sixth. Molina also singled ahead of Martinez's home run.
Cardinals reliever Matt Bowman induced Paul Goldschmidt to ground out with a runner on second to end the seventh.
Ketel Marte doubled and scored on a sacrifice fly by Chris Iannetta in Arizona's two-run second.
Arizona second baseman Chris Owings left in the second inning after apparently hurting his hand on a swing against Lynn.
Pinch-hitter A.J. Pollock was ejected in the ninth after a arguing a called strike.
The Diamondbacks' 60-45 record is the second-best in franchise history through 105 games. They went 64-41 in 2002 on the way to a 98-64 mark and a first-place finish in the NL West.
Diamondbacks: LHP Robbie Ray remains on the seven-day concussion disabled list after he was hit by a line drive in Friday's 10-5 loss.
Cardinals: OF Stephen Piscotty is expected to return to the team on Tuesday after a short rehab stint in Single-A Peoria. He was put on the 10-day disabled list on July 15 with a groin issue.
Diamondbacks: Open a three-game series at Chicago on Tuesday against the Cubs. Arizona has yet to announce a starter. LHP Jon Lester (8-6, 3.88) will start for the Cubs.
Cardinals: RHP Carlos Martinez (7-8. 3.52) begins a three-game series at Milwaukee on Tuesday. He will be opposed by RHP Jimmy Nelson (8-5, 3.38). The Cardinals are 1-5 in Martinez's last six starts.