TORONTO (AP) -- After holding onto the AL East lead for more than 3½ months, the Yankees appeared set to fall out of first place on Sunday. Then they rallied from a four-run deficit, headed home still tied with Baltimore for the AL East lead and later clinched their 17th postseason berth in 18 years.
"Tonight was a season-defining game for us," New York's Nick Swisher said after a 9-6 win at the Toronto Blue Jays. "We could have gone down big like that and just packed it in, but that's not this team's M.O. That's not how we approach it."
Eduardo Nunez drove in the go-ahead run with an eighth-inning sacrifice fly. Eric Chavez homered for the Yankees (92-67), who completed a 4-3 trip and headed home for a season-closing series against Boston. The Orioles (92-67) beat the Red Sox 6-3 and traveled to Florida for their final series, at Tampa Bay.
"Every game feels like it's a playoff game right now," Russell Martin said. "That's our attitude."
New York has overcome four-run deficits to win twice in a nine-game span for the second time this season, according to STATS LLC. The Yankees and Orioles both clinched no worse than a wild-card berth when Texas (93-66) beat the Angels 8-7 in the second game of a day-night doubleheader, dropping Los Angeles to 88-71.
With both the division title and the AL's best record still up for grabs, the Yankees aren't relishing the prospect of playing the last-place Red Sox, who have lost 90 games for the first time since 1966.
"They would like nothing better than to spoil our season," Martin said. "Us knowing that, I don't think anybody is going to take them lightly."
A wild-card berth and the one-game playoff that comes with it isn't to New York's liking. The Yankees opened a 10-game AL East lead in mid-July and have never failed to finish first in a season in which they led by at least 6½ games.
"This team wants to win a division," Swisher said. "That's it. I don't ever think in the history of Yankee baseball we've shot for the wild card. That's not how we get down over here. This city, this team expects to win and that's what I expect us to go out and do."
Toronto took a 5-1 lead in the fifth against Phil Hughes, but the Yankees closed in the sixth on a run-scoring pitch by Henderson Alvarez and tied it an inning later on Ichiro Suzuki's sacrifice fly, Robinson Cano's RBI double against Steve Delabar and Aaron Loup's run-scoring wild pitch.
"It seemed liked we just kept at it, kept at it, kept picking away," manager Joe Girardi said.
Darren Oliver (3-4) walked Curtis Granderson leading off the seventh, Raul Ibanez singled, Martin sacrificed and Nunez drove in the go-ahead run. Derek Jeter's RBI single put the Yankees ahead 7-5.
"It's a big win for us to be able come back in that situation," Girardi said.
Granderson added a two-run single in the ninth off Jason Frasor, reaching 100 RBIs for the second straight year despite a .226 batting average.
Boone Logan (7-2) got the final two outs of the seventh as the Yankees avoided consecutive defeats for the first time since a three-game skid from Sept. 2-4. Rafael Soriano allowed Toronto to load the bases with no outs in the ninth before Yunel Escobar hit into a run-scoring, double-play grounder and Adam Lind grounded out.
Hughes gave up five runs, eight hits and two walks in 4 2-3 innings. He allowed his 35th home run, trailing only Ervin Santana of the Los Angeles Angels.
"It was a bad day," Hughes said. "Fortunately the guys battled back and we got a win, which we really needed."
New York's rally spoiled a strong start by Alvarez, who closed his season by allowing two runs and seven hits in six innings.
"He goes into the offseason, I would think, with a lot of confidence about the way he's pitched late in the season," Blue Jays manager John Farrell said.
Toronto went ahead in the first on Escobar's RBI double and Lind's sacrifice fly. Chavez hit his 16th home run in the third, connecting off Brett Cecil, but the Blue Jays scored three times in the bottom half on Brett Lawrie's two-run homer, a second-deck drive to left, and Moises Sierra's RBI single.
NOTES: New York 1B Mark Teixeira is expected to rejoin the Yankees on Monday to play against Boston. Teixeira has played just one game since Aug. 27 because of a strained left calf. ... Baltimore's win clinched home field for the Orioles if there is a one-game tiebreaker game to decide the AL East. ...
Alex Rodriguez has failed to drive in a run in 11 straight games for the first time since May 27-July 7, 2005, according to STATS LLC. He is hitting .250 with two doubles, three homers and 12 RBIs in 100 at-bats since returning from the DL on Sept. 3. ... Blue Jays slugger Edwin Encarnacion left in the seventh with muscle tightness in his left shoulder and neck. Colby Rasmus pinch hit for Encarnacion and struck out. ... Suzuki retired Encarnacion with a running catch in the right field corner to begin the third, a play Girardi called "tremendous." ... Yankees INF Jayson Nix is expected to miss 10 to 14 days with a strained left hip.