Updated

Kelly Johnson and Miguel Montero homered in a five-run sixth inning, and the Arizona Diamondbacks stopped a seven-game losing streak with a 9-6 victory over the New York Mets on Friday night.

Montero also doubled, singled and drove in four runs for the last-place Diamondbacks, who won for the first time since finishing a three-game sweep of the struggling Mets last Wednesday in Arizona.

New York wasted David Wright's two long homers and five RBIs, done in by a dreadful relief outing from left-hander Raul Valdes (2-3) after another shaky start by Mike Pelfrey. Valdes gave up hits to all four batters he faced, turning a one-run lead into a 9-5 deficit in 14 pitches.

Arizona's outburst was aided by Jose Reyes' error at shortstop and it made a winner of Ian Kennedy (6-8), who went six innings and allowed only three hits. Two of them were no-doubt homers by Wright — a three-run shot that tied it in the first and a two-run drive that put New York up 5-4 in the third.

Chad Qualls struck out two in a perfect eighth and ex-Met Aaron Heilman got three outs for his fourth save, sealing the Mets' 14th loss in 19 games.

Two fans carrying Mexican flags ran into the outfield during the seventh inning but were apprehended by security fairly quickly without much incident.

Before the game, a group of about 40 demonstrators across the street from Citi Field protested Arizona's immigration law, chanting and handing out leaflets that requested Major League Baseball move next year's All-Star game from Phoenix.

Pelfrey threw 51 pitches in the first inning July 19 at Arizona and was chased after getting only four outs, the shortest start of his career. He yielded six runs and seven hits in a 13-2 loss.

The big right-hander, 0-3 in six starts since beating Minnesota on June 25, recovered from a rough first inning in this one and left with a chance to win after throwing 118 pitches.

Pelfrey retired seven batters in a row before Kennedy reached on Reyes' one-out error in the sixth. One out later, Valdes entered to face the left-handed hitting Johnson, who drove a 1-1 pitch to center for his 17th home run and a 6-5 Diamondbacks lead.

Justin Upton and Adam LaRoche singled before Montero drove the next pitch off the facing of the second deck in right field.

Mets manager Jerry Manuel then pulled Valdes, and both were booed as they came off the field.

Reyes, who had three hits, doubled in the seventh and scored on Angel Pagan's two-out single off Blaine Boyer.

LaRoche, Montero and Mark Reynolds hit consecutive RBI singles in the first inning, the last two deflecting off the glove of a diving Wright at third base.

Pelfrey is 0-5 in seven career starts against Arizona.

NOTES: Upton extended his hitting streak to a team-best 15 games. ... The Diamondbacks traded away an All-Star pitcher for the second time in a week Friday when they shipped right-hander Edwin Jackson to the Chicago White Sox for rookie Daniel Hudson and prospect David Holmberg. Arizona sent three-time All-Star Dan Haren to the Los Angeles Angels for left-hander Joe Saunders and three other players last week. ... Mets C Henry Blanco made a throwing error in the first inning, his first error in 108 games since July 24, 2008, with the Chicago Cubs against Florida. Blanco went 795 chances between errors, according to STATS LLC. ... It was Wright's 15th career multihomer game and second this season. ... The previous Mets player to drive in five runs in a game also was Wright, who had six RBIs on Sept. 12 at Philadelphia. ... Manuel might rest CF Carlos Beltran on Sunday. ... The Mets placed LF Jason Bay (concussion) on the 15-day disabled list and recalled OF Jesus Feliciano from Triple-A Buffalo. ... All-Pro tight end Dallas Clark of the Indianapolis Colts took batting practice at Citi Field hours before the game and chatted with Wright in the dugout.