Jose Bautista hit a tie-breaking three-run homer in an absolutely wild seventh inning, and the Blue Jays rallied to beat the Texas Rangers, 6-3, in Toronto on Wednesday and win a turbulent, decisive Game 5 of the American League Division Series.

The win allowed the Blue Jays to complete their rally from a 2-0 deficit in the best-of-five series and advance to their first American League Championship Series since 1993.

Toronto rallied for four runs in the bottom of the seventh after Texas took a 3-2 lead in the top of the frame when Blue Jays catcher Russell Martin's throw back to the mound deflected off Shin-Soo Choo's bat, scoring Rougned Odor.

The umpires conferred several times and awarded Texas the go-ahead run, prompting fans in Toronto to litter the Rogers Centre field with debris. Blue Jays manager John Gibbons then told the umpiring crew his team was playing the game under a formal protest.

In the bottom of the wacky seventh, the first three Toronto batters reached base thanks to three errors by the Rangers. Texas ace Cole Hamels was removed for reliever Sam Dyson after Ben Revere hit a grounder that forced out pinch runner Dalton Pompey at home.

Blue Jays third baseman Josh Donaldson then singled off Dyson to score Kevin Pillar with the game-tying run. Bautista’s go-ahead homer — punctuated by a gratuitous bat flip — came just a few pitches later. Including his RBI-double in the third inning, the Toronto slugger drove in four runs in the game.

Hamels took the loss for Texas. Aaron Sanchez got the win in relief for Toronto; Roberto Osuna notched the save.

Edwin Encarnacion went 2-for-2 with a homer and two walks for the Blue Jays, who will face the Royals in the ALCS on Friday.

ALDS Recap: Toronto defeats Texas, 3-2

Game 1: Texas 5, Toronto 3
Game 2: Texas 6, Toronto 4 (14)
Game 3: Toronto 5, Texas 1
Game 4: Toronto 8, Texas 4
Game 5: Toronto 6, Texas 3
Best-of-five