New York dropped to 0-5 this year against teams that currently have winning records, and is 17-8 against teams below .500. The Yankees had won nine of 10 heading into the series against the Diamondbacks but wound up heading home 6-3 on their western swing.
''How can you not say that you feel fortunate when they're minus Stanton and Judge?'' Lovullo said.
Kelly (3-2) allowed one run and five hits in 5 1/3 innings as Arizona won for the seventh time in nine games. The 30-year-old rookie right-hander won consecutive big league starts for the first time.
He escaped a bases-loaded jam in the fifth when Brett Gardner hit an inning-ending groundout, then gave up Luke Voit's ninth homer leading off the sixth that cut Arizona's lead to 3-1. Voit has reached base in 41 consecutive games, the longest for the Yankees since Mark Teixeira in 2010.
''Fastball command was some of the best I've had, which I was happy with, and I was able to throw the curve ball for strikes,'' Kelly said.
Gleyber Torres doubled with one out, and Yoshihisa Hirano relieved and threw a called third strike past Mike Tauchman and then retired Gio Urshela on a popout. Urshela started for the first time since he was hit by a pitch on the left hand Sunday.
Tauchman hit an RBI single in the eighth off Archie Bradley, who got Urshela to hit into an inning-ending forceout. Greg Holland pitched around Cameron Maybin's one-out walk in the ninth to remain perfect in seven save chances.
Masahiro Tanaka (2-3) allowed three runs and five hits in four innings, which matched his season low. He threw more splitters and got 11 swings and misses among 74 pitches, up from one swing and miss in his previous start, a loss to the Los Angeles Angels.
''Bottom line is we pitched well enough, three runs back to back days,'' Yankees manager Aaron Boone said. ''Just haven't been able to mount enough offensively and that is partly a credit to them for being able to hold us down and make pitches in those situations.''
Yankees catcher Gary Sanchez has been behind the plate for six wild pitches in 14 games this season.
Marte led off the fourth with his seventh homer, a drive above the pool deck in right field.
''I feel we have a very good team,'' Marte said of the D-backs, who are 18-13. ''We have a team here with a lot of talent and we can compete with anybody.''
Bob Brenly, who managed the Diamondbacks to their World Series title in 2001 in seven games over the Yankees, threw Wednesday's ceremonial first pitch. Brenly is a commentator on Diamondbacks' TV broadcasts.
Boone was ejected by plate umpire Paul Emmel, his second ejection of the season. Boone was angered when his challenge whether Ahmed remained on second base on a force play was denied in a fifth-inning video review. He didn't have a challenge available in the seventh when he thought Tyler Wade was hit by a pitch. Boone has been ejected twice this season and six times as Yankees manager.
''I wasn't even set off other than we couldn't look at it based on the call earlier where he was safe at second base,'' Boone said. ''I thought it was a quick, very quick ejection. Then I got riled up.''
Yankees: SS Troy Tulowitzki singled in the first inning for Class A Tampa on Wednesday, then was removed for a pinch runner. Tulowitzki was hit on a leg by a pitch Tuesday night. ... INF DJ LeMahieu missed the series with knee inflammation. He fouled a pitch off a knee Friday at San Francisco, then left Sunday's game against the Giants in the third inning. ... 3B Miguel Andujar (right shoulder) was 1 for 4 with a two-run single as the DH for Class A Tampa and was 1 for 8 in two games. ... OF Clint Frazier (left ankle sprain) did some pregame work in the outfield and can be activated from the IL this week. ... OF Aaron Hicks (back) was the DH in an extended spring training intrasquad game. He singled in three at-bats and walked twice, and is to play five innings in center field on Thursday.
Yankees: LHP James Paxton (3-2) starts Friday night's homestand opener against Minnesota and will be pitching on six days' rest.
Diamondbacks: LHP Robbie Ray (1-1, 4.18 ERA) is scheduled to start Friday at Colorado.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports