MIAMI (AP)Zac Gallen outpitched Pablo Lopez as the Arizona Diamondbacks built a lead and held on to beat the Miami Marlins 5-4 Monday night.

David Peralta homered, singled twice and drove in three runs, and Daulton Varsho hit two doubles for the Diamondbacks, who have won five of seven. Arizona’s Jordan Luplow had two hits and two RBIs.

In a matchup of starters who entered with ERAs under one, Gallen (1-0) threw 6 1/3 innings of two-run ball. He allowed five hits, struck out six and hit two batters.

”I knew I was going to have my A game tonight,” Gallen said. ”There was motivation there.”

Lopez’s string of 18 2/3 scoreless innings ended in the first on Peralta’s two-run homer. Varsho hit a leadoff double before Peralta sent Lopez’s first pitch over the wall in right.

”I’m always ready for the first pitch,” Peralta said. ”I was ready to hit. He has a great change-up. That’s his best pitch. He was trying to get ahead with the fastball. He made a mistake and I hit the mistake. It really worked well for the team. It set a tone in the beginning of the game.”

The Diamondbacks chased Lopez (3-1) after two-out RBI singles by Luplow and Peralta in the fifth that made it 4-0.

”They made me work a lot,” Lopez said. ”I made mistakes and I paid for them. It was also one of those nights when I executed my pitches and they put the barrel on the ball somehow. I’ve gotta be more consistent.”

Lopez, who earlier Monday was named NL Pitcher of the Month for April, allowed four runs, six hits, walked two and struck out seven. His ERA rose from 0.39 to 1.61.

”I thought Pablo was kind of off a tick all night long,” Marlins manager Don Mattingly said. ”Seemed like he wasn’t nearly as consistent as we’ve seen so far, but I thought he did a nice job of hanging in there and battle.”

Arizona padded its lead on Luplow’s RBI single off Marlins reliever Richard Bleier in the seventh.

”The entire lineup was patient with its approach and took advantage of the right opportunities,” Peralta said.

Down 5-0, Miami rallied with four runs against Gallen and reliever Noe Ramirez in the seventh. Jazz Chisholm Jr. hit a two-out, two-run double off Ramirez. Jesus Aguilar followed with an infield single that scored two as Chisholm raced from second and beat first baseman Christian Walker’s throw. Ramirez retired Jorge Soler on a fly to left for the third out.

Gallen hit Avisail Garcia and Garrett Cooper to start the inning and his outing ended after he struck out Brian Anderson. Ramirez relieved Gallen and hit Jacob Stallings to load the bases.

”I ran out of steam a little bit,” Gallen said. ”The change-up got away from Garcia and the sinker got away from Cooper. I was trying to attack and be as efficient as possible. I was smelling blood at the end of the game there.”

Joe Mantiply pitched a perfect eighth and Ian Kennedy pitched around a single and walk in the ninth for his second save.

CELEBRATED MATCHUP

Much was made of the Gallen-Lopez matchup, but another faceoff that drew attention involved Gallen and Chisholm Jr. Gallen and Chisholm were traded for each other July 31, 2019, and they had their first confrontation Monday. Chisholm, who had said in a podcast last year that he would homer off Gallen when they faced each other, flew out twice and grounded out to second in his at-bats against the former Marlin.

”There was a lot of emotion tonight so I was trying to keep that in check,” Gallen said. ”He made some comments last year, so I’ve been sitting on that for about a year now. It worked in our favor. We won the game. That’s the most important thing.”

ROSTER MOVES

The Diamondbacks designated IF Matt Davidson for assignment and optioned RHP Taylor Widener to Triple-A Reno. … The Marlins optioned RHP Zach Pop to Triple-A Jacksonville and designated RHP Shawn Armstrong for assignment.

TRAINER’S ROOM

Diamondbacks: IF Josh Rojas (strained right oblique) is scheduled to play rehab games soon.

Marlins: Jose Devers (right shoulder impingement) is progressing with his throwing program. The next step would be appearing in extended spring training games.

UP NEXT

RHP Humberto Castellanos (1-1, 5.79) will start the middle game of the series for the Diamondbacks on Tuesday. The Marlins will go with LHP Trevor Rogers (1-3, 5.09).

More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports