Updated

PITTSBURGH -- Chris Owings singled home the go-ahead run in the 14th inning and the Arizona Diamondbacks outlasted the Pittsburgh Pirates 6-5 on Wednesday in a game that took more than 4 1/2 hours to play -- plus a 93-minute rain delay.

Paul Goldschmidt and Nick Ahmed homered for the Diamondbacks, who led in the ninth and 11th before finally putting away the Pirates. T.J. McFarland (3-0) pitched three hitless innings for the win.

Ahmed hit a solo shot in the 11th but Jordy Mercer tied the score in the bottom half with a home run of his own as steady showers began to fall. The game was delayed by rain after the 11th inning for 1 hour, 33 minutes.

David Peralta singled off Jhan Marinez (0-3) to start the 14th and advanced to second on Goldschmidt's groundout. Jake Lamb was intentionally walked, and Peralta scored when Owings singled to right field.

Marinez, the last man in the Pirates' bullpen, worked three innings in a game that lasted 4 hours, 40 minutes.

Pittsburgh tied it at 4 in the ninth against closer Fernando Rodney without getting a hit. Francisco Cervelli and Andrew McCutchen walked, Gift Ngoepe reached on Goldschmidt's error at first base, and Mercer grounded into a run-scoring double play.

Goldschmidt homered off reliever Daniel Hudson leading off the sixth. Lamb then doubled and came home on Chris Iannetta's RBI groundout.

Arizona started the scoring in the third thanks to some unforced errors by the Pirates. Chad Kuhl issued walks to Gregor Blanco and Goldschmidt. Lamb drove a ball to shallow right-center, where McCutchen made a diving attempt. But he missed, letting the ball roll all the way to the wall as two runs scored.

The Pirates got two back in the fifth and received some positive injury news as well. McCutchen and Jose Osuna hit back-to-back doubles to start the inning, and pinch-hitter Gregory Polanco added an RBI single.

Polanco left the field on a cart during Monday's game with what initially appeared to be a serious right ankle injury, but he made a quick recovery and was able to contribute less than two full days later. After Polanco reached base, he was removed for a pinch runner.

Diamondbacks starter Zack Godley gave up three runs over six innings, raising his ERA from 1.99 to 2.39.

Kuhl allowed two runs and three hits in five innings.

TRAINER'S ROOM

Pirates: RHP Jameson Taillon will make his second rehab start Friday with Triple-A Indianapolis as he returns from surgery to treat testicular cancer. . Relief pitchers Josh Lindblom (left oblique discomfort) and Antonio Bastardo (left quad strain) were scheduled to make rehab appearances with Indianapolis on Wednesday night.

Diamondbacks: RHP Taijuan Walker threw a 60-pitch simulated game and might be ready to rejoin the rotation, but Randall Delgado will make at least one more spot start before Walker goes for Arizona again. Delgado will start Saturday in Miami. Arizona manger Torey Lovullo has not yet announced a starter for Sunday.

UP NEXT

Diamondbacks: RHP Zack Greinke (6-3, 3.24) pitches Thursday night in the opener of a four-game set at Miami. Greinke has 89 strikeouts this season, tied with teammate Robbie Ray for third in the National League.