McCutchen doubled in a run in the Pirates’ three-run first inning and broke a 3-all tie with his sacrifice fly after Starling Marte’s leadoff triple in the fifth.

Jeanmar Gomez (1-0) got the victory in relief of Wandy Rodriguez, who left after 2 1-3 innings because of tightness in his left hamstring. Trevor Cahill (0-2) allowed four runs and four hits in five innings for the Diamondbacks, who had won four in a row and were coming off a three-game sweep at Milwaukee.

Alfredo Marte drove in a run for Arizona with his first major league hit.

Jason Grilli pitched a scoreless ninth for his second save.

Arizona’s Paul Goldschmidt had a sacrifice fly, giving him an RBI in a career-best five straight games, but the Diamondbacks didn’t get a hit in the last five innings. Justin Wilson threw three innings of hitless relief before Mark Melancon and Grilli closed it out.

The Pirates, who hadn’t won since opening day, got to Cahill in a hurry.

Starling Marte opened the game with a single, then scored when McCutchen doubled down the left-field line. With two outs, Cahill walked Russell Martin and Pedro Alvarez to load the bases, and Travis Snider followed with a two-run single.

Arizona got one back when Goldschmidt doubled to deep left and scored on Wil Nieves’ two-out single.

Two unearned runs for the Diamondbacks tied it at 3 in the third.

Gerardo Parra reached on an error by Alvarez at third base for running in front of shortstop Clint Barmes, impeding Barmes’ ability to field the ball. That’s when Pirates trainers rushed to the mound and, after trying to stretch and throwing a practice pitch, Rodriguez left the game and Jeanmar Gomez came in.

Martin Prado singled and Aaron Hill walked to load the bases for Goldschmidt, who narrowly missed a grand slam on a deep drive to left for a sacrifice fly. With two outs, Alfredo Marte drove in the tying run with his first major league hit.

The Pirates, entering the game with a .119 batting average in the first six games, went back up 4-3 in the fifth when Starling Marte tripled into the left-field corner and scored on McCutchen’s sacrifice fly.

Jones’ solo home run to right on a 2-2 pitch from Josh Collmenter in the eighth made it 5-3.

Pittsburgh batters struck out 12 times.

Notes

With a storm front moving through the area, the roof at Chase Field was closed. ... Alfredo Marte’s hit came in his seventh at-bat. ... In the second game of the series tonight, the Pirates send RHP James McDonald (0-1) to the mound against RHP Brandon McCarthy (0-0). ... Pittsburgh had not scored more than three runs in any of its first six games and managed just two runs total while being swept by the Dodgers in Los Angeles last weekend. ... Arizona LHP Matt Reynolds has allowed one hit in five scoreless innings this season. ... The Pirates homered for the second straight game after hitting none in their first five.