NEW YORK — Gio Urshela made like Derek Jeter, and Aaron Judge was his quintessential self.

After a season of surges and setbacks, the New York Yankees are set to find out who they really are in the postseason.

Might as well start against the rival Red Sox.

Judge drove home the winning run with a one-out single in the ninth inning and the Yankees clinched a playoff berth in their final at-bat of the regular season by beating the Tampa Bay Rays 1-0 Sunday.

“It’s been a crazy, wild, tough year,” manager Aaron Boone said. “Fitting that it would come down to the last day to get in, but I love our group.”

Urshela made a Jeter-esque catch, charging recklessly into the visitors’ dugout in the sixth inning, and New York used six pitchers in a five-hitter to punch its fifth consecutive postseason ticket after nearly falling into a labyrinth of tiebreaker scenarios.

The Yankees had their bags packed, knowing another loss to the 100-win Rays could send them into one of several potential Game 163s on the road Monday. Instead, they’ll play in Tuesday night’s AL wild-card game at Fenway Park, with ace Gerrit Cole facing the Red Sox after Boston rallied to beat Washington later Sunday.

The Yankees swept a three-game series in Boston last weekend, and the teams finished tied for second in the AL East behind Tampa Bay at 92-70. The Red Sox host the wild-card game because they went 10-9 against New York this year.

New York was a .500 club past the midpoint of the season, falling to 41-41 on July 4. The Yankees are 51-29 since.

“We’re ready to take our shot,” Boone said. “Feel like I know we can beat anyone when we’re at our best.”

Rougned Odor led off the ninth with a single against Josh Fleming (10-8), just New York’s second hit. Pinch-runner Tyler Wade advanced to second on Gleyber Torres’ flyout to the warning track in center, and Anthony Rizzo moved Wade to third with a sharp one-out single.

Andrew Kittredge came on to face Judge, who ripped a 104.4 mph line drive off the right-hander’s glove. The ball skipped toward drawn-in second baseman Brandon Lowe, whose off-balance throw home wasn’t nearly in time to catch a sliding Wade.

Teammates swarmed a smiling Judge midway between first and second, and fans chanted “MVP! MVP!” at the face of the franchise during an on-field interview.

“I wouldn’t say we exhaled,” Judge said. “We still have a lot of work to do.”

Judge had never delivered a walk-off hit in the majors. This one was his eighth go-ahead hit in the eighth inning or later this season, tied for the most in the majors and the most by a Yankee since at least 1961.

“That’s the guy you want up right there,” Wade said.

New York needed a win or losses by Toronto and Seattle to clinch and avoid a tiebreaker Monday. With the out-of-town scoreboard showing the Blue Jays routing Baltimore from the start, it was clear by the fourth inning the Yankees wouldn’t back into a wild-card spot.

Rays starter Michael Wacha wasn’t getting out of the way, either. The veteran pitched one-hit ball over five innings, steamrolling New York with 56 pitches. He induced two double plays, pushing New York’s AL-most total to 154.

Urshela restored a charge into Yankee Stadium with his brazen bolt into Tampa Bay’s dugout.

With two outs in the sixth, Urshela sprinted 126 feet after Austin Meadows’ popup from a shifted infield formation. He caught it a stride before reaching the top step of the Rays’ dugout, then appeared to leap from the warning track full-speed into an empty spot on the bench.

Plate umpire Angel Hernandez flipped over the railing chasing after him to confirm the out call while Tampa Bay players quickly waved toward the home dugout for a trainer. Boone ran across the field and was followed by members of the medical staff. Pinstriped teammates gathered near the dugout entrance while Urshela was tended to.

“He looked like a missile flying in there,” Boone said. “It scared me to death.”

Urshela emerged about a minute later and limped back to the Yankees bench to chants of “Gio! Gio!” Astoundingly, he returned to shortstop for the seventh inning despite a stiffening bruise on his left thigh. He grounded out in his next at-bat in the eighth inning, then was replaced by Andrew Velazquez in the ninth.

Jeter, inducted into the Hall of Fame last month, famously bloodied his face diving into the third-base seats after catching a popup in a game against rival Boston on July 1, 2004.

Urshela isn’t sure how he landed, but he’s glad it wasn’t on his head. He opened his eyes after crashing and saw the ball in his glove, then worried momentarily that he was seriously injured.

“It felt like a lot of pain in that moment,” he said.

Boone said there wasn’t any structural damage, but Urshela will be re-evaluated Monday before determining his future availability. The slick-fielding infielder had a more exaggerated limp after the game.

Yankees right-hander Jameson Taillon delivered 3 1/3 scoreless innings in his second start since partially tearing a ligament in his right ankle last month. Wandy Peralta, Clay Holmes, Chad Green and Jonathan Loaisiga got the ball to closer Aroldis Chapman in the ninth with the game still scoreless.

Chapman (6-4) struck out two and stranded a runner to keep it 0-0.

New York had just one hit through eight innings, although Gary Sánchez hit two rockets in the eighth. The first sailed wide of the left-field foul pole, and the other was caught with a diving effort by left fielder Brett Phillips.

This was the fifth time the Yankees entered the final day of the regular season still in contention for a postseason spot and first since 1995.

Tampa Bay rookie Randy Arozarena led off the eighth with a single and stole second, giving him 20 homers and 20 stolen bases. Only Tommy Pham and B.J. Upton had previously reached those marks in the same season for the Rays.

“I was happy he got it, too,” manager Kevin Cash said, “beacuse I was tired of hearing, ‘Green light! Green light!’ all the time from him.”

TRAINER’S ROOM

Yankees: INF DJ LeMahieu went on the 10-day injured list with a sports hernia, likely keeping him out through the AL Division Series if New York advances that far. ... New York recalled rookie RHP Luis Gil.

UP NEXT

Yankees: Cole (16-8, 3.23 ERA) gets the ball Tuesday night in Boston.

Rays: Host the opener of an AL Division Series on Thursday against the winner of the AL wild-card game.