The Yankees, who entered the night 3 1/2 games behind the Rangers and Rays -- who were facing each other -- in the American League Wild Card race, gained a game in their pursuit of a playoff spot after the Indians, who began the night one-half game back of Texas and Tampa Bay, fell in their contest against the Royals.
"This team never quits," said manager Joe Girardi. "We have a pretty mature group. They know what they have to do."
New York, which was shut out for the 10th time this season in Tuesday's opener, was held scoreless over the first 16 innings of the series before the four-run eighth helped it avoid being shut out in back-to-back contests for the first time since May 1999.
Trailing, 3-0, entering the eighth, the Yankees' bats finally came to life.
After Brendan Ryan -- who chased Toronto starter J.A. Happ from the contest -- and Curtis Granderson started off the eighth with back-to-back hits, Robinson Cano drove in New York's first run of the series with an RBI single to right off reliever Steve Delabar. Alfonso Soriano followed with an RBI double, and Wells capped off the rally with a two-run double to left to give the Yankees their first lead of the series.
"It looked like things were going in the same direction as they did [Tuesday]," said Wells, "That's what we are capable of doing. We needed a win, things have been ugly over the last few days.
"Hopefully this is something that can kick-start something special for us."
Despite taking the lead, New York wasn't in the clear. David Robertson retired the first two batters in the bottom half of the frame before allowing a two-out single to Rajai Davis. With Brett Lawrie at first, Davis stole second base -- his 42nd steal of the season -- prompting Girardi to turn to Rivera and replace Robertson mid at-bat.
Rivera escaped the frame and then had to hold off Toronto's ninth-inning rally.
The Yankees closer allowed back-to-back hits, but got two outs before striking out J.P. Arencibia to end the threat.
Girardi doesn't turn to Rivera in the eighth very often but, with the Yankees fighting for a spot in the postseason, he felt it was best to put the fate of the game into the hands of the "greatest relief pitcher of all time."
"We have to be prepared for that and I know these games are crucial," said Rivera, who saved his 44th game of the season. "Everybody has to be on their game, everybody has to be ready, because they can call any time."
Lefty David Huff threw 3 1/3 innings of one-run ball in relief, allowing one hit while striking out three to earn his third win of the season. It marked the fifth time this year that Huff has thrown at least three innings of relief in a game.
Huff admitted things have been getting tense in the dugout in recent days.
"It's getting late in the season," said Huff, whose only blemish came with two outs in the fourth when rookie Ryan Goins drove a 3-2 pitch over the wall in right for his first career home run. "Guys are checking the scoreboard during the game, maybe some guys are tightening up a little bit. We just need to take a deep breath and relax and play our game. We know if we do that, we can compete with anybody."
Huff replaced starter Phil Hughes, who battled through three innings, retiring nine of the 11 batters he faced before the Blue Jays got to him in the fourth.
Just as he did Tuesday, Colby Rasmus broke open a scoreless affair in the fourth inning by crushing a 2-1 Hughes offering into the second deck in right field for his 22nd homer of the season to put the Blue Jays ahead, 2-0. It was the fourth consecutive game Rasmus has homered.
That was it for Hughes, who Girardi has had on an extremely short leash. It was the second consecutive start that Hughes has failed to complete four innings, and he hasn't won over his last 12 starts, the longest winless streak of his career.
Hughes, who last won July 2 and is 0-6 with a 5.33 ERA in his 12 starts over that stretch, was just happy New York escaped with a victory and has a chance to win the series in Thursday's finale. He felt he was throwing well but understands why Girardi was quick to yank him.
"This time of the year, you can't really complain too much," Hughes said. "I know the situation I'm in and I'm trying to embrace it as much as I can."
Happ had his way with the Yankees and recorded his first quality start in his last seven outings. He retired 11 of the final 13 batters he faced and threw seven-plus innings of one-run ball. The lefty surrendered four hits, walked three and struck out a season-high seven batters.
"It's definitely nice to get results and finally go deeper into the ballgame," said Happ, who pitched at least six innings for just the fourth time in 16 starts.
The Yankees improved to 14-4 against the Blue Jays this season and enter Thursday -- the final game of their 10-game road trip -- with a 4-5 record.