NEW YORK — When the Orioles clinched a playoff berth last September, it was euphoric.

The walk-off win and wild celebration that followed were fitting for what had been a magical season with many highs and few lows.

Tuesday night, the Orioles’ playoff clinch didn’t have the same feeling of ecstasy. They’ve been limping to the finish line amid a trying second half. Crippling injuries and slumping bats turned what was one of MLB’s best teams in the first half into a mediocre one since. They’ve been on the verge of clinching for days but haven’t been able to win.

But none of that alters the reality of the achievement: The Orioles are going back to the playoffs.

After a six-year drought, the Orioles will play in the postseason in consecutive seasons. The last time Baltimore clinched a playoff spot in back-to-back years was 1996-97 — before Adley Rutschman, Gunnar Henderson or Jackson Holliday were born.

The Orioles’ 5-3 win over the Yankees on Tuesday night was an encouraging sign to kick off the final week of the regular season — seven days before the playoffs begin. But it did not automatically clinch the Orioles a spot in the postseason. Instead, Baltimore and its fans held their collective breath for 10 minutes to learn if they’d clinch, as the feat required a loss by another wild-card hopeful later in the night. The Minnesota Twins provided just that with a 4-1 loss to the Miami Marlins, sending the Orioles dancing and, for at least one night, providing an excuse to ignore their concerning September slide and celebrate their persevering achievement.

As the Twins lost, Orioles players were huddled in the visiting clubhouse at Yankee Stadium, staring at the televisions hanging from the center. When the Marlins recorded the final out, they screamed as if releasing a second half’s worth of frustration. Manager Brandon Hyde gave a toast, and then the real celebration began.

“This feeling doesn’t get old,” center fielder Cedric Mullins said.

Leading into the Tuesday, it wasn’t certain if or how the Orioles would celebrate clinching, since it’s been a foregone conclusion for months they’d be a playoff team. Had they done so Sunday, they might not have at all because of travel restrictions.

But the team wanted to celebrate. It’s been a long, difficult season. Recently, it’s felt like it will end in disappointment. But that’s even more reason why, they said, to celebrate — to recognize how challenging this road has been and how their goals still lie ahead.

“One thing I try to remind the young guys is this is really hard to do,” veteran catcher James McCann said. “So enjoy every second of it. You never know when it’s going to happen again.”

The party wasn’t as crazy as either clinch celebrations last year — especially the first one when Orioles players went buck wild. This celebration still had its fair share of harmless tomfoolery — from Colton Cowser’s mini video camera to McCann and Rutschman chugging from the “Homer Hydration Station” to Holliday’s “Bird Bath” sparkling water because he’s not yet 21 years old.

“Next year, we’ll be getting after it,” Holliday said with a boyish smile, his cheeks as red as ever.

As the Orioles spent September stuck in quicksand, the Yankees emerged from theirs. What was the tightest division race in baseball quickly turned into a lopsided affair. Baltimore held a half-game lead over New York on Sept. 6 after spending the previous two months within three games of each other. But the Orioles won only five of their next 15 contests while the Yankees surged to begin the series this week in the Bronx with a six-game advantage.

While the Orioles’ chances of defending their American League East crown are infinitesimal, the past week has perhaps foreshadowed brighter days ahead. They won back-to-back games in impressive fashion Thursday and Friday. A quartet of injured players — reliever Danny Coulombe and infielders Jordan Westburg, Ramón Urías and Ryan Mountcastle — returned from the injured list with the hope of providing their beleaguered club a boost. And Tuesday, they went toe-to-toe with the AL’s best team and emerged victorious.

As general manager Mike Elias wished earlier this month, the Orioles could be on the way to getting their “mojo” back.

“I feel like we’re turning the corner at the right time,” Henderson said Saturday. “We’re starting to get things going again. Pitchers have been throwing the ball well for the past week, week and a half. And now the bats are starting to get going. It seems like we’re moving in the right direction.”

The Orioles and their fans certainly would’ve preferred a playoff clinch be sewn up Saturday or Sunday when Baltimore entered both days with scenarios to punch its ticket to October. But perhaps it’s fate that it took until Dean Kremer was on the mound for the job to be finished.

Kremer’s arrival to Baltimore in July 2018 signaled the beginning of the Orioles’ rebuild. The young pitcher wasn’t viewed as the gem of the Orioles’ return for Manny Machado, but he turned out to be the best player Baltimore received. However, his path from young Orioles prospect to clutch big league starter wasn’t linear. After debuting in 2020, Kremer opened the 2021 campaign in the majors and was repeatedly battered, earning four demotions to Triple-A and ending the season with a 7.55 ERA for a club that lost 110 games.

Now, Kremer has started three of the most important games for the Elias-era Orioles. The intense and focused right-hander started and pitched splendidly in both of Baltimore’s clinch wins last season — first for the postseason against the Tampa Bay Rays, second for the AL East title against the Boston Red Sox. He delivered again Tuesday, pitching five innings of one-run ball for the win.

How did Kremer handle the pressure of pitching in another clinch game? He didn’t even know it was one.

“Not my job to know that,” Kremer quipped with a wry smile.

The 2024 Orioles have yet to reach 90 wins while the 2023 version racked up 101 wins for the franchise’s most in a single season since 1979. In the second half, it felt as if these Orioles were missing the magic those Orioles had. But the core that powered both clubs to the postseason — a combination of stars, top prospects, castoffs and rebuild survivors — is what links them.

The Orioles sent five players to the All-Star Game this summer, with Henderson, an AL Most Valuable Player Award candidate, participating in the Home Run Derby and Burnes, a Cy Young Award candidate, starting for the American League. But a group of unheralded players such as Emmanuel Rivera, Albert Suárez and Urías, who homered Tuesday, helped keep the team afloat during the most difficult stretches of the season. Youngster Colton Cowser emerged as the AL Rookie of the Year front-runner, while top prospects Holliday and Coby Mayo made their MLB debuts.

And binding this group together were Anthony Santander, who hit his career-high 44th homer Tuesday, Cedric Mullins, Mountcastle, Kremer and Hyde — a group who believed a light was at the end of the Orioles’ rebuilding tunnel. It turned out to be so bright that clinching a playoff berth with room to spare was seen as a disappointment.

The Orioles’ second-half struggles are why they believe they’re even better positioned for a playoff run than last year. Those Orioles barely faced adversity. They cruised through the season, ending each month with a winning record en route to tallying 101 victories. And then the season came crashing down in October when they were swept by the Texas Rangers in the AL Division Series.

“We have a lot of the same core group of guys that were here on the team last year. I think that experience is going to be helpful,” Hyde said Saturday. “Last year was kind of this ride where a lot of things went well. We stayed really healthy … and won a lot of games that maybe we shouldn’t have. This year’s been more difficult. This has been more of a challenge, and I think our guys are only going to be better going forward because of it.”

Baltimore is now five games behind the Yankees for first place in the AL East and four games up on the Kansas City Royals for the top wild-card spot. That makes it likely the Orioles will begin the postseason at Camden Yards in the best-of-three AL wild-card series.

It will be a more difficult path for the Orioles to win their first World Series title since 1983. But, given how this season’s gone, they’d prefer it no other way.

“We’re more battle-tested this year,” Henderson said.

Baltimore Sun reporter Matt Weyrich contributed to this article.