NEW YORK — If anyone in the Orioles’ lineup was feeling hangover effects from the playoff clinch celebration Tuesday night, it didn’t show on the field.

Baltimore opened Wednesday night’s game against the Yankees with six straight singles and racked up 17 hits on the night to cruise to its second-straight win over New York, 9-7. All nine members of the Orioles’ starting lineup recorded at least one base hit, led by Gunnar Henderson’s three-hit performance and three RBIs off the bat of Colton Cowser. New York nearly made a dramatic comeback in the ninth when Aaron Judge hit a three-run home run to cut Baltimore’s lead to two, but Keegan Akin retired Austin Wells and Giancarlo Stanton to end the game.

Despite having already secured a postseason berth, the Orioles (88-70) still had plenty to play for with their magic number for the top wild-card spot down to two heading into the contest. The Yankees did too, needing a win to sew up the American League East and ensure a first-round bye. But for the second straight night, the Orioles played from ahead as their lineup — restocked with recent additions from the injured list — looked the part of a playoff contender.

The Yankees scratched starter Nestor Cortes on Wednesday morning and placed him on the 15-day IL with a left elbow flexor strain, forcing right-hander Marcus Stroman to return from the bullpen and make a spot start. Henderson greeted him with a leadoff single and five Orioles hitters followed suit, giving them six consecutive singles to start a game for the first time since at least 1969 when full play-by-play data was first recorded, according to MLB.com.

After Jordan Westburg and Anthony Santander helped load the bases, Cowser hit a flyball down the left field line that rookie outfielder Jasson Domínguez couldn’t track down. Two runs scored and a third followed two batters later when Ryan Mountcastle ripped a single up the middle.

Zach Eflin then took the mound with a 3-0 lead, looking to finish the regular season strong in what was expected to be his final start before the playoffs. However, Eflin’s command wasn’t nearly as sharp as it had been over his first eight starts with the Orioles — or at any point in his nine-year MLB career. He walked a career-high five batters, including four in the first two innings.

The Yankees took advantage of two of those free passes. Shortstop Anthony Volpe brought one around on an RBI single in the second and Juan Soto scored the other with a two-run home run in the fifth. Eflin tried to overcome the blast, which only would’ve been a home run at Yankee Stadium and no other ballpark in MLB, and get through the fifth to qualify for the win, but Judge singled and Wells walked to knock him out of the game.

He still lasted longer than Stroman, who ran into more trouble with the Orioles’ lineup in the fourth. Ramón Urías and Cedric Mullins opened the frame with back-to-back singles and Mullins stole the first of his two bases on the night to put two runners in scoring position. Henderson then brought them both home with a two-run single to force Yankees manager Aaron Boone to turn to his bullpen.

Right-hander Clayton Beeter wasn’t much better, allowing consecutive RBI doubles — the Orioles’ first two extra-base hits of the game after they had put up 10 singles — to Santander and Cowser. Henderson’s second run scored gave him 118 for the season, tying Al Bumbry for the fourth-most runs in a single season in Orioles history with four games left to play.

The Orioles tacked on another run in the fifth on a single by James McCann before Eflin’s jam prompted manager Brandon Hyde to turn to his bullpen. Jacob Webb allowed an infield single to Stanton on a rocket line drive off Henderson’s glove but escaped without allowing further damage by getting Jazz Chisholm Jr. to fly out to end the inning. Westburg, who is 4-for-12 since returning from the injured list, also drove in one more run with a base hit in the eighth.

Webb pitched a clean sixth and both Danny Coulombe and Gregory Soto followed suit. Matt Bowman, who entered the game with a 0.69 ERA, then gave New York a chance to climb back into it when Soto brought a run home with a single and Judge hit a three-run shot to left. However, Akin entered the game and retired both Wells and Stanton to secure his first save of the season and third of his career.

Baltimore pulled to within four games of the Yankees in the AL East with the win, clinching its first series victory since taking two of three from the Chicago White Sox in early September. Corbin Burnes is scheduled to start the series finale Thursday with the Orioles aiming for the sweep. The Yankees will send their ace to the mound as well in Gerrit Cole.