TORONTO -- Edwin Encarnacion's bases-loaded single in the ninth inning gave the Toronto Blue Jays a dramatic 4-3 comeback win over New York Yankees on Sunday.

The Yankees, who had been shut out their three previous games, had gone ahead 3-2 after getting to Toronto closer Roberto Osuna for two runs in the ninth.

Melvin Upton Jr. walked to open the bottom of the ninth and moved to third on a Kevin Pillar single off Tyler Clippard (3-6). Upton scored on Ezequiel Carrera's bunt with Clippard given an error on the play.

Devon Travis struck out and Josh Donaldson was walked intentionally to load the bases for Encarnacion.

Jose Bautista, whose three-run blast gave the Jays a 3-0 win Saturday, looked to have delivered the win with an RBI single in the eighth for a 2-1 lead.

But Osuna (3-2) gave up singles to Mark Teixeira and pinch-hitter Billy Butler to open the ninth. With one out, Mason Williams' RBI single tied the game at 2-2. And the Yankees went ahead on Ronald Torreyes' sacrifice fly.

Bautista opened the scoring with a solo homer in the fourth before a Rogers Centre capacity crowd of 47,896 with the lid open, the 38th sellout of the season.

Then he put Toronto ahead in the eighth with a single up the middle off six-foot-eight fireballer Dellin Betances, who was clocked at 101 m.p.h. during the inning. That scored Donaldson who had advanced to third on a walk, stolen base and Encarnacion groundout.

Didi Gregorius hit a solo homer to open the seventh, ending a 33-inning scoreless drought for the Yankees.

Toronto (86-69) has won five of six -- and seven of 10 after a 3-9 start to September.

New York (79-76) has lost four straight and is 2-8 going into the series finale Monday, which marks the end of an 11-game, 12-day road trip.

Also Sunday the AL East-leading Red Sox played at Tampa. Boston defeated the Rays 6-4 Saturday, clinching a playoff berth with its 10th straight win.

Wild card rivals Detroit hosted Kansas City and Baltimore entertained Arizona.

One day after a pitching duel between Marcus Stroman and Yankees veteran C.C. Sabathia, Toronto's Marco Estrada and Michael Pineda dominated on the mound.

The Jays entered the day holding the top AL wild-card spot, leading Baltimore by a 1/2 game and Detroit by two. In his last start, Estrada took a no-hitter into the seventh inning in a 3-2 win over Seattle. But he had struggled prior to that, going 1-5 in his previous seven starts.

He went seven innings Sunday, giving up one run on four hits with seven strikeouts and two walks. He threw 103 pitches, including 70 strikes.

Estrada was sharp in a 1-2-3 first, befuddling Yankee batters with his 73 mile-per-hour changeup. He loaded the bases with one out in the second on a double, walk and single but escaped unscathed with a strikeout and popup.

Including those two outs, the Jays right-hander retired 14 in a row before Gregorius homered to right-centre field for his 20th of the season.

Pineda, meanwhile, dispatched 13 of 14 with the Bautista blast the sole blemish during a run that started with two outs in the first and ran through the fifth inning.

The six-foot-seven 260-pounder struck out seven, including a sequence of five straight in the second and third innings. He came into the game sixth in the AL with 195 strikeouts.

Pineda went 5 2/3 innings giving up one run on three hits with three walks in a 97-pitch outing. His nine-start winless streak (0-1 with eight no-decisions) is a career high although he probably deserved better Sunday. Pineda's last win was Aug. 5 against Cleveland.

He retired eight straight after walking Bautista in the first. The Jays slugger ended that run in the fourth with his solo drive over the left-field fence on a 2-1 delivery for his 21st of the season.

After a double play erased a Travis walks, Encarnacion got on with a two-out bloop single in the sixth, advancing to third on a wild pitch and passed ball. Pineda was pulled after walking Bautista. Reliever Adam Warren ended the threat.

Both teams had chances in the seventh.

Estrada gave up a single and walk after the Gregorius homer but three strikeouts ended the rally. Toronto had men on second and third with one out but was unable to cash them in.

With a Yankee on second with one out in the eighth, reliever Joaquin Benoit recored two strikeouts including a nine-pitch battle with rookie phenom Gary Sanchez.

The Jays blanked the Yankees 9-0 and 3-0 in the first two games of the series, which followed a 2-0 shutout at the hands of the Tampa Rays. It marked the first time New York has been shut out in three straight games since July 1975.

Since 1914, Major League Baseball teams have been blanked in four straight games just nine times. It has not happened to an AL team in the era of the DH (since 1973).

The Yankees, who managed a total of just six hits in the first two games of this series, have lost eight straight at Rogers Centre.

Bautista's first-inning walk extended his streak of reaching base safely to 32 straight games.