Scherzer (7-6) notched the win with 6 2/3 innings in which he allowed two runs on eight hits and fanned eight.
Jeff Francoeur had a leadoff home run in the second inning for the Mets, who lost for the eighth time in their last 10 games.
Livan Hernandez (7-7) lasted only four innings in the start, giving up five runs on six hits and three walks. He struck out five.
Francoeur's homer tied the game 1-1 but the Diamondbacks scored three times in the third to take a 4-1 lead. Romero had a two-run single in the frame.
The two teams traded runs in the fourth, and Ryan Roberts singled in the sixth run for the Diamondbacks in the seventh.