TORONTO -- Six outs away from a second straight shutout loss, the New York Yankees gave their diminishing playoff hopes a big boost.
Vernon Wells had a go-ahead two-run double in the eighth inning, Mariano Rivera earned a four-out save and the Yankees rallied from three runs down to beat the Toronto Blue Jays 4-3 Wednesday night, snapping a four-game skid.
"We hadn't shaken hands for a while, so it was kind of nice," manager Joe Girardi said.
Robinson Cano drove in the Yankees' first run in this three-game series with a one-out single in the eighth. Alfonso Soriano followed with an RBI double, helping New York avoid falling further behind in the AL wild-card race.
"Tonight was a big game for us," Rivera said. "Being down 3-0 in the eighth inning and coming back to score four and being able to hold it, it's a huge game, huge."
New York is 2½ games behind Texas for the second wild card. The Yankees have 10 games remaining. The Rays beat Rangers 4-3 in 12 innings.
"There's still a long way to go, but it's a lot better feeling in this clubhouse than it's been for a while," Girardi said.
"All these games are huge," Huff said. "We need to continue it, we need to keep getting after it and keep winning. There are no more little bumps in the road, it's get it done or go home."
Alex Rodriguez went 0-for-4 with a walk as the Yankees improved to 8-2 this season following a shutout loss. New York, which lost 2-0 Tuesday, has gone 34-11 following shutout defeats since Girardi took over as manager before the 2008 season.
Goins' homer was the only hit allowed by Huff, who came on after Rasmus connected off Hughes in the fourth.
David Robertson got two outs in the eighth and Rivera finished it off for his 44th save in 51 chances. Rivera entered to a standing ovation from the crowd of 24,247.
"I don't think there's any arguing who the greatest relief pitcher of all time is and that's what I went with," Girardi said.
Still, it wasn't easy for Rivera. Adam Lind singled to begin the ninth and was replaced by pinch-runner Kevin Pillar, who went to second when Rasmus followed with a base hit. Pillar was forced at third on pinch-hitter Munenori Kawasaki's attempted sacrifice, Goins grounded out and Rivera fanned J.P. Arencibia on three pitches to leave runners at second and third.
"Every time you win, it's a great feeling," Rivera said. "Hopefully we come back tomorrow and wrap it up."
Blue Jays left-hander J.A. Happ matched a season-high by pitching seven innings but was denied his second win in three starts when the Yankees rallied in the eighth.
Aaron Loup replaced Happ after Brendan Ryan doubled to begin the inning but left after giving up a single to Curtis Granderson. Steve Delabar (5-5) came on and struck out Rodriguez, then gave up an RBI single to Cano, New York's first run in 16 innings. Soriano hit an RBI double and Wells followed with a two-run double.
"That's what we're capable of doing," Wells said. "We just haven't been able to do that lately. We needed a win, things have been ugly over the last few days."
Happ allowed one run and four hits in seven-plus innings. He walked two and struck out a season-high seven.
"We (threw) it away but he's got to feel good about that outing," Blue Jays manager John Gibbons said.
Delabar said he felt bad about ruining Happ's stong outing.
"To come in and not get the job done, it's a slap in the face," Delabar said. "Couldn't feel worse."
Rasmus hit a two-run shot into the second deck off Hughes in the fourth, his 22nd of the season. One out later, Goins drilled a solo shot off Huff.
Rasmus has homered in four straight games since being activated off the 15-day disabled list before Friday's game against Baltimore. He hit a solo home run in Tuesday's 2-0 win.
Hughes, who has not won since July 2 at Minnesota, allowed two runs and four hits in 3 1/3 innings. He walked none and struck out two.
The Blue Jays are 4-14 against the Yankees this season. ... Murphy started at catcher for the Yankees, with Chris Stewart getting the day off. ... Yankees LHP Boone Logan (elbow) threw a bullpen session before the game and could return Friday when New York hosts San Francisco.