NEW YORK — The next generation of New York Yankees will have a chance to make their mark in the playoffs.

Ending a rare two-year absence from the postseason, the Yankees clinched a wild-card berth with three games to spare by beating the Boston Red Sox 4-1 Thursday night for the franchise’s 10,000th regular-season win.

Carlos Beltran homered along with rookies Greg Bird and Rob Refsnyder on a drizzly, chilly evening that made sultry summer days seem long ago. CC Sabathia won for the second time since the All-Star break.

“It’s extremely gratifying,” Manager Joe Girardi said. “It wasn’t easy.”

Putting behind the venerated teams of Derek Jeter and Mariano Rivera, New York (87-72) opens the playoffs with a winner-take-all game on Tuesday, most likely against Houston or the Los Angeles Angels.

New York had failed to reach the playoffs in consecutive years for the first time since its 1982-93 drought, just before the start of a golden age that included five World Series titles and seven AL pennants from 1996-2009.

“We’ll never forget what Derek did for this organization,” Girardi said, “but you have to move on.”

But these Yankees bear little resemblance to even their last postseason team of 36 months ago. Among the players swept by Detroit in the 2012 AL Championship Series, only Alex Rodriguez, Brett Gardner, Mark Teixeira and Sabathia remain, and Teixeira will miss this postseason because of a broken leg.

Now Beltran, Jacoby Ellsbury, Chase Headley, Brian McCann and Didi Gregorius support a creaky starting rotation, a strong back end of the bullpen and sputtering middle relievers.

Masahiro Tanaka is lined up to pitch the wild-card game, with the winner advancing to a division series against East champion Toronto or Central winner Kansas City.

After Dellin Betances struck out Josh Rutledge to end it, the Yankees jogged onto the field to congratulate each other, along the lines of a normal win, although rookie catcher John Ryan Murphy did a little jumping.

While the Yankees celebrated a clincher in their clubhouse for the first time since beating Baltimore in the 2012 division series, a wild card isn’t what they expected. New York led the AL East by seven games before play on July 29 but has been a .500 club since then.

The Yankees had never before failed to finish first in a season in which they led by more than six games.

The crowd seemed less than half the 40,033 tickets sold for the first night of October baseball.

After losing the first three games of the series, New York built a 2-0 lead in the second against Rich Hill (2-1), who revived his career this summer during a stint with the Long Island Ducks of the independent Atlantic League. Beltran hit his 19th homer, an opposite-field drive over the right-field scoreboard, No. 9 hitter Brendan Ryan singled in a run for his first RBI since July 31.

NOTES: Red Sox DH David Ortiz was out of the starting lineup with general soreness and may not start in the final series this weekend. … OF Rusney Castillo returned to the lineup after missing three games because of his right quadriceps.