PHOENIX (AP) — Josh Rojas scored the winning run in the ninth inning when shortstop C.J. Abrams couldn't handle a throw at second base, and the Arizona Diamondbacks rallied from a late six-run deficit to beat the San Diego Padres 7-6 on Tuesday night.

Arizona trailed 6-0 after six innings, but scored four in the seventh and tied it with two more in the eighth.

Mark Melancon (3-6) stranded a runner at third in the ninth inning after a leadoff walk and two wild pitches, setting the stage for a dramatic finish.

Taylor Rogers (0-4) got the first two outs in the bottom half, but gave up singles to Rojas and Ketel Marte. Christian Walker then hit a squibber to the right side and first baseman Eric Hosmer threw to second trying to get Marte. He slid hard into the bag, jarring the ball from Abrams' grasp, and Rojas dove headfirst into home plate to set off a wild celebration.

It didn't look good for the Diamondbacks early.

Arizona struggled against Sean Manaea — one infield single — and San Diego seemed to be in control after scoring six runs off Zac Gallen in the fifth. Jorge Alfaro hit a three-run double in the inning and Nomar Mazara a two-run homer.

Leading 6-0, Padres manager Bob Melvin decided to send Manaea back out for the seventh.

The move backfired.

Bobby Kennedy chased the left-hander with a two-run double and Carson Kelly followed with a run-scoring double off Tim Hill. Alek Thomas cut San Diego's lead to 6-4 with an RBI groundout.

Arizona loaded the bases with no outs in the eighth and Luis Garcia hit Kennedy with a pitch to force in a run. Another hit batter tied the game, but San Diego turned a home-to-second double play and Rogers struck out Thomas to end the inning.

TRAINER'S TABLE

Padres: 3B Manny Machado ran the bases and fielded grounders before the game as he nears a return from a sprained left ankle

Diamondbacks: RHP Zach Davies was placed on the 15-day injured list, retroactive to June 26, due to right shoulder inflammation. He is 2-4 with a 3.94 ERA in 15 starts this season. Arizona recalled RHP Sean Poppen from Triple-A Reno and must decide what to do about Davies' spot in the rotation.

UP NEXT

Arizona LHP Madison Bumgarner has allowed two runs or less in six of seven home games heading into Wednesday's start against San Diego RHP Mike Clevinger.

___

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