MILWAUKEE (AP)For the New York Mets, a playoff spot was certainly worth celebrating. Even if they still have bigger goals on the table in the middle of a heated pennant race.

Max Scherzer was pulled from his 200th win with a perfect game intact, and the Mets clinched their first trip to the postseason in six years by beating the Milwaukee Brewers 7-2 on Monday night.

Reinstated from the injured list before the game, Scherzer (10-4) struck out nine in six innings. The 38-year-old ace threw only 68 pitches, but that was as far as the NL East leaders let him go in his first start in 16 days.

Brewers star Christian Yelich doubled leading off the seventh against Tylor Megill, making his first major league relief appearance after 27 starts. Megill also came off the injured list earlier in the day.

Pete Alonso hit a three-run homer off reigning NL Cy Young Award winner Corbin Burnes (10-8), and the Mets won their fifth straight to wrap up at least one of the three National League wild cards. They lead their division by one game over defending World Series champion Atlanta, which beat Washington 5-2 at home.

”This is what you play the game for. You play the game to go to the postseason,” Scherzer said. ”We have a lot of things in front of us and we understand that. But, man, you’ve got to celebrate the good times, too.”

Mets players and coaches hugged and high-fived on the field after the final out, then enjoyed a boozy but subdued celebration in the clubhouse.

”This is just the first step. I have high expectations,” owner Steven Cohen, wearing a Mets cap, said after giving a postgame speech to the team. ”If we can win the division, that would be great. Obviously, Atlanta is a great team, and it will probably go down to the wire, and then we’ll see what happens in the playoffs. I think this is a team that can go really far.”

It is the 10th postseason appearance in the franchise’s 61-season history, and first since the Mets lost to San Francisco in the 2016 NL wild-card game.

”We understand this is not the end goal, but it’s part of our destiny,” shortstop Francisco Lindor said.

Mets players took a group photo and selfies on the field after the game. In the clubhouse, Scherzer held a bottle of Ace of Spades champagne while drinking out of a paper Gatorade cup.

”It’s a mature group that revels, stays in the moment,” first-year Mets manager Buck Showalter said.

Scherzer was activated Monday after recovering from left oblique irritation. Showalter said before the game ”we’re not going to go too deep with Max physically” in his first big league start since Sept. 3.

On his fourth try for win No. 200, the three-time Cy Young Award winner fanned Yelich, Willy Adames, Hunter Renfroe and Garrett Mitchell two times each.

Andrew McCutchen hit a line drive to right field off Scherzer in the second, but it was caught by a sliding Tyler Naquin to end the inning.

Scherzer sprinted to the mound before each inning. He often had the ball in hand before most of his teammates emerged from the dugout.

A smiling Scherzer received a hearty round of high-fives from teammates when he returned to the dugout after the sixth, indicating he was done for the night.

”Our chemistry is unparalleled,” said Alonso, headed to the playoffs for the first time in his career.

Scherzer exited his previous start with fatigue on his left side and went on the IL with oblique irritation. He also went on the injured list with a left oblique strain in May and was activated July 5.

”He didn’t give us many pitches to hit,” Brewers manager Craig Counsell said. ”Lots of strikes, got ahead of us. We didn’t do anything against him.”

The loss dropped Milwaukee 8 1/2 games behind first-place St. Louis in the NL Central and 2 1/2 games back of Philadelphia for the third NL wild card. The Brewers had won two of three games against the Yankees in Milwaukee over the weekend.

With one out in the fourth, Burnes gave up consecutive singles before Alonso hit a 1-2 changeup 437 feet for his 36th home run to stake New York to a 3-0 lead.

Alonso’s 118 RBIs lead the NL.

New York (94-55) extended its lead to 5-0 in the sixth after back-to-back triples by Brandon Nimmo and Lindor, and an RBI double by Daniel Vogelbach.

The previous Mets players to hit consecutive triples were Jose Reyes and Jason Bay in April 2010.

Rowdy Tellez hit a two-run homer off Megill in the seventh, his 32nd.

It was the Mets’ first win in Milwaukee since May 2018. They had lost their last nine road games against the Brewers, and 14 of the past 15.

”A lot of blood, sweat and tears poured into this. Many years of hard work to try and get to this point,” Nimmo said about reaching the playoffs. ”It’s been a little bit of a drought. … We’re excited to celebrate it and enjoy this.”

EXCLUSIVE CLUB

Scherzer (200-101) joined Justin Verlander (243 wins) and Zack Greinke (223) as the only active pitchers with 200 career wins.

UP NEXT

The middle game of the series is Tuesday night. LHP Aaron Ashby (2-10, 4.58 ERA) returns from a stint on the IL with left shoulder inflammation to start a bullpen game for Milwaukee. New York goes with RHP Carlos Carrasco (15-6, 3.70). He gave up one run over six innings in each of his last two starts, striking out 17 total batters.

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