Sonny Gray pitched Oakland into baseball’s last playoff spot, shutting out King Felix this October.

David Price delivered the AL Central crown to Detroit, St. Louis scratched ace Adam Wainwright after wrapping up the NL Central.

And on a final day that featured Derek Jeter’s farewell, Jordan Zimmermann injected even more drama by throwing a no-hitter preserved when Washington rookie Steven Souza Jr. made a catch for the ages.

“Just an epic day for an epic season,” Nationals outfielder Denard Span said.

Going into Sunday’s first pitch, not a single postseason matchup was set — and the possibility of three tiebreakers loomed. Hours later, the brackets were all settled in Game 162.

Gray blanked Texas 4-0, helping the shaky Athletics hold off Felix Hernandez and the Seattle Mariners for the second AL wild-card slot. The A’s open this year’s postseason at Kansas City on Tuesday night, with Jon Lester facing the Royals’ James Shields.

The Royals went 5-2 against the A’s this season — both losses were to Lester.

For Oakland slugger Adam Dunn, it will be his first playoff appearance. He has been in 2,001 games, the most by any active major leaguer without reaching the postseason.

“I played scenarios of this day out in my head probably a thousand times,” Dunn said.

On Wednesday night, Madison Bumgarner and San Francisco visit Edinson Volquez and Pittsburgh in the NL wild-card game.

The Pirates lost their chance to catch the Cardinals with a 4-1 loss to Cincinnati. No matter; they’ll be back home at PNC Park, where they won the wild-card game last season.

“I expect it to be like last year: So loud you can’t hear the ball off the bat,” said Josh Harrison, who almost won the NL batting title.

Both of the best-of-five AL division series begin Thursday. It’ll be the wild-card winner at the Los Angeles Angels and the Tigers at Baltimore. In NL openers Friday, the wild card plays at Washington and the Cardinals are at the Dodgers.

Price, acquired by Detroit in late July to win big games, stopped Minnesota 3-0. The Tigers needed a win to close out the Royals for the division title.

“On a day where we needed an enormous outing after giving up 20-something runs over the previous two, he stepped right up. He showed why he’s a true No. 1,” first-year Tigers manager Brad Ausmus said.

At Fenway Park, the World Series champion Boston Red Sox and the New York Yankees were long gone from the playoff race. But the place was packed for Jeter’s goodbye.

On his final swing, Jeter chopped an RBI single. He left to a rousing ovation, stopping to embrace Boston pitcher Clay Buchholz on the mound.

The 40-year-old Jeter left after 20 years with 3,465 hits, five World Series rings and no regrets. “I felt like the time was right,” he said.

The Nationals punctuated a season in which they had the NL’s best record with an exclamation point — the first no-hitter in team history.

Zimmermann was in control until two outs in the ninth, when Christian Yelich hit a deep drive. Souza, in left field as a defensive replacement, raced back into the gap and made a sensational diving grab.

Zimmermann winced when the ball was hit, figuring it was bound to be a “no-doubt double.”

“And then he comes out of nowhere and makes that catch,” Zimmermann said.