Updated

Cody Ransom's RBI singled capped a three-run eighth inning the Arizona Diamondbacks used to down the New York Mets, 5-4, in the first of a three-game set at Citi Field.

Ransom also hit a two-run home run and finished with three RBI for the Diamondbacks, who snapped a two-game slide.

Brad Ziegler (1-1) earned the win with a scoreless inning of relief, while Wade Miley allowed four runs on seven hits and two walks in a six-inning start for Arizona.

"I struggled with the fastball command all night...just kind of battled my way through it. The offense came back in the eighth and pulled it out," Miley said of his outing.

J.J. Putz tossed a perfect ninth for his sixth save of the year.

Jon Rauch (3-1) took the loss, giving up three hits and a run in two-thirds of an inning on the mound. Dillon Gee started the game for the Mets, allowing two runs on four hits and three walks over six full frames.

"There's no excuse not to go out there and execute pitches," Rauch said. "...I just didn't do it tonight."

Scott Hairston drove in a pair of runs for New York, which dropped its fourth straight game.

The Diamondbacks entered the eighth inning trailing, 4-2, after stranding a man on second base in the fifth and sixth innings, but was able to rally against the Mets' bullpen to take the lead.

Justin Upton led off the eighth with a hard grounder to first off Bobby Parnell that slipped through the legs of Ike Davis, and Jason Kubel followed with a walk off new pitcher Tim Byrdak to place runners on first and second.

Rauch took the bump next after Byrdak fanned Miguel Montero and Paul Goldschmidt greeted the new hurler by hammering a double into the right-center field gap to bring home Upton and Kubel.

Ransom followed with a base hit to bring home Goldschmidt and pinch-hitter Lyle Overbay later hit a ground-rule double to put runners on second and third, but Willie Bloomquist went down swinging to end the inning as Arizona took a 5-4 lead.

David Hernandez then stranded the tying run on third in the bottom of the eighth before Putz entered for the ninth and struck out Kirk Nieuwenhuis and Ruben Tejada before Daniel Murphy lined a ball to left-center field that Gerardo Parra snagged with a diving effort to end the game.

Arizona struck first in the second inning when Ransom smacked a two-run home run over the left-center field wall. Montero led off the frame with a walk prior to Ransom's one-out blast.

The Mets loaded the bases with no outs in the third on Tejada's leadoff single, Murphy's double and a walk to David Wright. After Lucas Duda was called out on strikes, Hairston laced a double to left field to score Tejada and Murphy.

Wright came home on a Davis groundout to second before Andres Torres' base hit to left plated Hairston to give New York a 4-2 lead.

Game Notes

Each member of the Mets came up to bat to a different Beastie Boys song in honor of New York native Adam "MCA" Yauch, who passed away earlier Friday...The Mets fell to 5-4 in the first game of a series this year...Wright increased his hit streak to 10 straight games and has now reached base safely in 22 of his 23 games this year...Arizona's Aaron Hill went 1-for-4 and has now reached base safely in 21 consecutive contests.