BUFFALO, N.Y. -- Vladimir Guerrero Jr., homered and ace Hyun-Jin Ryu threw seven shutout innings as the Toronto Blue Jays beat the New York Yankees 4-1 on Thursday night to wrap up their first post-season berth in four years.

Toronto survived a nervous eighth inning as New York scratched out a run off reliever Anthony Bass, who was pulled after loading the bases with his third walk of the frame.

Rafael Dolis came on and got pinch-hitter Gary Sanchez to fly out on a ball that Randal Grichuk caught against the wall in left-centre field for the third out.

Dolis returned for the ninth and when he fanned Aaron Hicks for his third strikeout of the inning, the party was on at Buffalo's Sahlen Field.

The Blue Jays celebrated near their dugout, with many players putting on T-shirts that read “Respect Toronto.”

“We keep believing in ourselves,” said manager Charlie Montoyo. “It's awesome. I'm so proud of this group. I'm the happiest guy right now.”

The Blue Jays (30-27) were in control of their playoff destiny after entering play with a magic number of one. The two teams that had a chance of catching Toronto - the Los Angeles Angels and Seattle Mariners - were idle.

Regular-season play continues through Sunday and the playoffs will begin Tuesday. All first-round series will be best-of-three matchups.

It's possible that the Blue Jays could still move up in the seeding order, but they are good bets to stay in the No. 8 position. If the season ended Thursday night, Toronto would meet the top-seeded Tampa Bay Rays.

Under Major League Baseball's expanded playoff structure, 16 teams will reach the playoffs. Division winners will be seeded Nos. 1-3 in each league, second-place teams will be seeded fourth through sixth, and two third-place wild-card teams will get the seventh and eighth seeds.

Guerrero had three of Toronto's 10 hits. He hit a solo homer off New York starter Jordan Montgomery in the second inning and scored on Alejandro Kirk's two-run double in the sixth inning.

Ryu pitched into the seventh inning for the first time this season, allowing five hits and two walks. He had four strikeouts and threw 62 of his 100 pitches for strikes.

Gio Urshela doubled off Ryu (5-2) in the second inning to extend his hitting streak to 13 games. He was left stranded when Clint Frazier struck out.

Guerrero turned on a 1-1 pitch from Montgomery (2-3) in the bottom half of the frame for his eighth homer. Back-to-back doubles from Cavan Biggio and Bo Bichette in the third made it a 2-0 game.

The Yankees (32-25) threatened in the sixth inning after singles by Luke Voit and Hicks. But Ryu struck out Giancarlo Stanton, got Gleyber Torres to fly out and then Urshela on a groundout.

Kirk, a rookie catcher who served as designated hitter, lashed a pitch from Adam Ottavino into the left-field corner to help the Blue Jays double their lead. Grichuk scored ahead of Guerrero, who hustled around third base and slid just under Kyle Higashioka's tag.

New York can't catch first-place Tampa Bay in the East and has a magic number of one to secure second place in the division.

Before the game, the Blue Jays activated right-hander Nate Pearson after a month-long stint on the injured list due to right elbow tightness. Reliever Wilmer Font was designated for assignment.

The Blue Jays won the wild-card game en route to an appearance in the American League Championship Series in 2016.

Toronto's last World Series victory came in 1993. A long playoff drought followed until the Blue Jays reached the ALCS in 2015.

Notes: The game took three hours 11 minutes to play. ... Dolis earned his fifth save. ... The Blue Jays will start a three-game series against the visiting Baltimore Orioles on Friday. The Yankees will close their season with a weekend set against the Miami Marlins. ... Toronto won three of four against New York and split their 10 games against the Yankees this year. ... The Blue Jays improved to 15-8 at Sahlen Field.

This report by The Canadian Press was first published Sept. 24, 2020.