TORONTO - Through six innings, Mark Buehrle appeared destined to get a victory over the Yankees, something that has eluded him for a decade.

But things changed dramatically in the seventh Friday night when the Yankees -- aided by two errors and Jacoby Ellsbury's two-run homer -- rallied for five runs on their way to a 6-3 win over the Blue Jays in front of 43,318 at Rogers Centre.

It was a solid bounce-back win for the Yankees after a brutal 3-2 loss Thursday in Detroit."Yesterday was a tough loss, but we've gone through a ton of them this year and you just have to go out and win today," Joe Girardi said beforehand.

Chris Capuano, who picked up his first win in seven starts since joining the Yankees July 24, allowed three runs (two earned) and eight hits in 61/3 innings. But Jose Bautista's fourth-inning blast, his 27th homer of the season, left the Yankees trailing 1-0 going into the seventh.

Brian McCann then doubled off the wall in right-center and Carlos Beltran walked before Brett Gardner drove one off the base of the wall in right-center. McCann scored on the play and second baseman Steve Tolleson's relay throw to third sailed and hit a fan in the stands. The error allowed Beltran to score and put Gardner at third.

After Ichiro Suzuki reached on an infield single, Buehrle was done, but the Yankees weren't.

With Ellsbury at the plate against lefthander Aaron Loup, catcher Dioner Navarro tried to pick Gardner off third and threw the ball into leftfield to make it 3-1. Ellsbury then laid into a 1-and-1 fastball and lined a low shot over the rightfield wall for his 14th homer and a 5-1 lead.

Buehrle, who allowed four runs and seven hits in six innings-plus, fell to 1-13 with a 6.14 ERA in 20 starts against the Yankees. He has lost 10 straight decisions against them dating to 2004.

The Blue Jays scored twice against Capuano in the bottom of the seventh to get within 5-3. After Kevin Pillar hit an RBI double against Capuano, Adam Warren allowed an inherited runner to score on a sacrifice fly by Melky Cabrera, but with two on and two out, he got Edwin Encarnacion to fly to right.

Without Dellin Betances, who had worked two straight games, Girardi continued in the eighth with Warren, who retired the first two batters before giving way to lefty Josh Outman, acquired late Thursday night from Cleveland. Outman allowed a single by Munenori Kawasaki and Girardi called on David Robertson, who struck out Colby Rasmus to end the eighth.

Chase Headley homered in the ninth to make it 6-3 and Ellsbury followed with a triple. When he tried to score on Derek Jeter's grounder, he was declared safe, then out after a Toronto challenge, keeping the lead at three runs.

Robertson pitched a perfect ninth to record his 35th save in 38 opportunities and fourth four-out save of the season.

Notes & quotes: The Yankees acquired Outman from the Indians Thursday night in exchange for a player to be named or cash considerations and added the reliever to the roster before Friday night's game, designating lefthanded reliever Rich Hill for assignment. Outman, 29, was 4-0 with a 3.28 ERA in 31 games for the Indians, holding lefties to a .180/.293/.380 slash line.

After going 12-for-17 through two innings-plus against former Cy Young Award winner David Price on Wednesday night -- including nine straight hits to begin an eight-run third -- the Yankees went 9-for-70 and scored two runs in the next 202/3 innings. But they produced six hits in their next eight at-bats, including four in Friday night's five-run seventh.