Rapid Reaction: Yankees 4, Red Sox 1

NEW YORK — Order was restored to the pinstriped portion of the universe Thursday night. After three straight losses to the precocious Boston Red Sox junior achievers, the New York Yankees finally won, 4-1, clinching a wild-card spot in the process.

In a game that began in steady rain, making phantoms of many of the 40,033 folks said to have purchased tickets for the occasion, the Yankees parlayed home runs by Carlos Beltran and rookies Greg Bird and Rob Refsnyder into their first trip to the playoffs since 2012.

The Yankees, who have won 87 games this season and 10,000 in the history of the franchise — the first team in the American League to reach that number — need another win or a Houston loss to clinch home-field advantage for Tuesday’s wild-card game.

Yankees relief ace Dellin Betances struck out Josh Rutledge for the game’s final out, the Yankees waiting until they ducked into their clubhouse to begin some serious celebrating.

Thumbs up: Pitching in conditions not fit for a duck, even a former Long Island Duck, Red Sox left-hander Rich Hill briefly faltered for the first time in four starts with the Red Sox, yielding a home run to Beltran to lead off the second, then surrendering another run in the 37-pitch inning on a couple of walks and a single by the No. 9 hitter in the order, Brendan Ryan. Hill walked as many batters in the inning as he had in his first 24 innings as a Sox starter, and walked one more in the third.

But the 35-year-old gathered himself, gave up just two more hits, stranded Chris Young on third base in the fourth and finished his six-inning stint with a flourish, striking out Alex Rodriguez, Beltran and Young in succession.

Thumbs down: The Sox bullpen had allowed just one earned run in 19 innings over the last week, that coming on A-Rod’s home run off Matt Barnes on Wednesday night. But reliever Jean Machi gave up a home run to Bird, the rookie’s 11th of the season, as the Yankees expanded their advantage to 3-1 in the seventh, and Refsnyder hit Heath Hembree’s first pitch of the eighth to make it 4-1.

Rutledge’s failure to execute a bunt — he popped it up — may have prevented the Sox from getting more than one run from three singles in the fifth, their only run off Yankees starter CC Sabathia.

What’s next: The Red Sox head to Cleveland to finish the season with three games against The Sons of Terry Francona. A sweep, and they would finish the season at .500, after being 14 games under .500 as late as Aug. 17, when they were 52-66. Henry Owens is scheduled to pitch Friday, Rick Porcello the season finale on Sunday, and reliever Craig Breslow is the most likely candidate to pitch Saturday. Interim manager Torey Lovullo said he will leave it up to David Ortiz how much he will play this weekend.