Cody Ransom hit a two-run homer and a go-ahead single in the eighth inning to help the Arizona Diamondbacks beat the Mets 5-4 on Friday night, handing New York its fourth straight loss.

Paul Goldschmidt hit a tying, two-run double in the eighth and Arizona won a one-run game after losing two in a row at Washington, each by a run. Arizona improved to 1-7 when trailing after seven innings.

The Diamondbacks were down 4-2 heading into the eighth. Justin Upton started the rally when his grounder went through the legs of Mets first baseman Ike Davis for an error.

(Copyright 2012 by The Associated Press.  All Rights Reserved.)