BOSTON — Early on Monday night, it looked like the Boston Red Sox might cruise to the ALCS after scoring five runs in the third inning.

While the Rays slowly chipped away at the lead throughout the night, eventually tying the game in the eighth inning, Boston displayed the resilience that made them the team that led the majors in comeback wins during the regular season, pulling off a walk-off 5-4 victory and propelling the Red Sox to the ALCS in a season when few expected the team to be playing this deep into the postseason.

Boston scored the winning run on a walk-off sacrifice fly from outfielder Kiké Hernandez after Christian Vazquez singled on a ground ball before being moved over to second base on a sacrifice bunt from Christian Arroyo. An infield single by Travis Shaw set up Hernandez, who played a crucial role in sparking the offense in both Game 2 and 3 to help propel the Red Sox to the ALCS.

The loss went to reliever J.P. Feyereisen, the eighth pitcher of the night for Tampa Bay, while Garrett Whitlock recorded the victory after pitching two innings, allowing no hits and no runs. Whitlock came in after reliever Ryan Brasier blew the save for Boston, allowing two runs to Tampa Bay in the eighth inning on an RBI double for Kevin Kiermaier and an RBI single for Randy Arozarena.