"I knew we weren't going to keep up the same offensive explosion we had the first three games," Martinez said. "I expected it. I just had to pitch along with Javy (Arizona starter Javier Vazquez)."
The Mets, coming off 14-1 and 18-4 victories, completed their first four-game sweep in more than two years and have won eight of 10 to move within 1½ games of Philadelphia in the NL wild-card race.
Arizona has lost five straight to drop 6½ games behind first-place San Diego in the NL West.
Martinez (13-5) snapped his two-game losing streak, limiting Arizona to two hits over six innings. He had six strikeouts to pass Mickey Lolich for 15th place on the career list with 2,835. The right-hander also walked four and hit a batter.
"He was erratically effective," Mets manager Willie Randolph said. "That was the most erratic we've seen him in a while. But he made the pitches when he had to."
Martinez said his arm felt stronger than in his past few starts, and the sudden liveliness left his arm out of synch with his legs.
"I'll find it eventually," Martinez said. "I do things differently. ... Eventually I'll find it. The last two innings I had it."
The Mets scored twice in the second inning. Cliff Floyd led off with a single, went to third on David Wright's single and scored on a double play grounder. Diaz followed with his ninth homer into the left-field stands. He also had a sacrifice fly in the ninth.
Braden Looper pitched the ninth for his 26th save.
Vazquez (10-13) allowed four hits and two runs in seven innings. He struck out six and walked two in losing for the fourth time in five starts. Vazquez is 3-9 since June 20.
"It's just disappointing to be losing all these games, man," Vazquez said. "It's really frustrating. We're not getting the job done and we're not winning games."
Arizona had good chances to score against Martinez in the first and sixth innings.
The Diamondbacks had runners on first and second with two outs in the first, but Martinez struck out Troy Glaus to end the inning.
In the sixth, Luis Gonzalez's one-out single broke up Martinez's no-hit bid and Tony Clark followed with a single. Martinez then struck out Glaus on a sweeping curveball and retired Shawn Green on a grounder.
"We had chances," Arizona's Craig Counsell said. "He struggled with his command and that got the pitch count up pretty fast but you've got to get that hit that brings in some runs. We just couldn't get it."
Martinez had thrown 100 pitches when he left for a pinch hitter in the seventh.
"You want to get into the bullpen," Arizona manager Bob Melvin said. "We're watching the pitch count go up, hits are at a premium and we're not even seeing too many balls up. We're trying to get him out of the game, and we do, and we had an opportunity right there."
Hernandez came in and got pinch-hitter Alex Cintron to hit a grounder to third as Clayton broke for home. Wright threw the ball to catcher Ramon Castro, who threw back to Wright at the bag to get Clayton. Second baseman Miguel Cairo ended the inning when he caught Counsell's line drive and underhanded the ball to shortstop Jose Reyes to double up McCracken.
"First and third, nobody out, you've got to find a way to score some runs right there," Melvin said.
- New York's last four-game sweep was Aug. 15-18, 2003, against Colorado at Shea Stadium.
- Glaus' seventh-inning error snapped Arizona's 68-inning errorless streak dating to Aug. 17 in St. Louis.
- Before the game, the Diamondbacks optioned RHP Greg Aquino to Triple-A Tucson and recalled RHP Jason Bulger. Bulger, the Diamondbacks' first-round pick in the 2001 amateur draft, was 3-6 with four saves and a 3.54 ERA for the Sidewinders. Aquino, who missed almost 2½ months with irritation in his right ulna, was 0-1 with a save and a 9.12 ERA in 28 appearances for Arizona.