PHOENIX — Chicago Cubs first baseman Anthony Rizzo made a remarkable catch, tumbling into the photo well to snag a foul ball.

And it might have cost the Cubs the game.

Josh Collmenter allowed only four hits in seven sharp innings, David Peralta drove in a pair of runs and the Diamondbacks beat the Cubs 3-2 on Sunday to complete a three-game sweep — their second sweep of the season and first at home.

Arizona scored twice in the sixth inning, the first on consecutive doubles by Ender Inciarte and Peralta. Peralta then scored from third when Rizzo caught Aaron Hill’s high pop foul while falling over the bar protecting the camera well near the Cubs dugout.

By rule, if a defensive player takes the ball out of play, each base runner is awarded a base.

Rizzo said it was “just instinct” that he lunged for the ball. “I didn’t think I would go in (the camera well),” he said. “But it was a little farther then I thought.”

In hindsight, Rizzo might have been better off just letting the ball drop foul.

But, he said, “I don’t think there is any Cubs fan that wanted me to miss it or any Diamondbacks fan that wanted me to catch it.”

The only run Collmenter (8-5) allowed was Rizzo’s 23rd home run, tying him with Miami’s Giancarlo Stanton for the NL lead.

“I was able to command the fastball both sides of the plate,” Collimenter said. “With a lot of lefties in the lineup I was able to pitch in really well, got a lot of popups and ground balls and the defense made some great plays.”

Addison Reed pitched a perfect ninth for his 23rd save in 28 tries.

The Diamondbacks won a challenge in the seventh when Mark Trumbo was called out stealing second. After a review, the call was reversed. Trumbo scored when Peralta singled.

The Diamondbacks are 3-0 after the All-Star break for the second time in franchise history. The other was in 2002.