Pete Alonso hit two home runs to take the major league lead, Jacob deGrom struck out 11 and the Mets beat the Arizona Diamondbacks, 3-1, Monday night in the opener of a crucial four-game series for both teams.

The Diamondbacks began the day one and a half games behind the Cubs for the second N.L. wild-card spot and the Mets trailed Chicago by four. The Cubs played later at San Diego.

Alonso hit a solo drive in the first inning, then connected for his 47th home run in the fifth. He moved two ahead Mike Trout for most in the majors and closed within five of Aaron Judge’s rookie record of 52 set two years ago.

Alonso recorded his fourth career multi-homer game. The first baseman also set a team record by reaching base safely in his 34th consecutive game.