Alex Bregman of the Houston Astros hits a solo home run in the eighth inning against the Boston Red Sox on October 9, 2017

New York (AFP) - The Houston Astros rallied for a wild 5-4 victory over the Red Sox in Boston on Monday to advance in the Major League Baseball playoffs.

The Astros won the best-of-five American League division series three games to one.

They’ll battle either the New York Yankees or Cleveland Indians for a World Series berth.

Astros infielder Alex Bregman belted a game-tying home run off Red Sox ace hurler Chris Sale – pitching in relief – to lead off the eighth inning and Josh Reddick delivered a two-out run-batted-in single later in the inning off of Red Sox closing pitcher Craig Kimbrel that put the Astros up 4-3.

Ken Giles held the Red Sox scoreless in the bottom of the eighth, and Kimbrel gave up a two-out, run-scoring double to Carlos Beltran that made it 5-3 for the visitors.

The Red Sox gave disheartened, rain-soaked fans at Fenway Park a last glimmer of hope in the bottom of the ninth when Rafael Devers led off the inning with a drive to deep left center field off Astros closer Ken Giles. It bounced off the wall and gave Devers an inside-the-park home run.

But it wasn’t enough as the Astros reached a league championship series for the first time since 2005 – when they were in the National League.

George Springer and Jose Altuve drove in one run each for the Astros.

Josh Reddick of the Houston Astros celebrates with teammates in the clubhouse after defeating the Boston Red Sox 5-4 in game four of the American League Division Series at Fenway Park on October 9, 2017 in Boston, Massachusetts

Andrew Benintendi hit a game-tying two-run homer in the fifth inning and Xander Bogaerts smacked his first career playoff homer, a solo blast in the first, for the Red Sox.

Game one starter Justin Verlander, making his first career relief appearance, earned the victory, allowing one earned run on one hit, Benintendi’s homer, with two walks in 2 23 innings.

Boston manager John Farrell was ejected in the second inning for arguing balls and strikes.

The Astros will open the ALCS on Friday either at Cleveland or at home to the Yankees.

“We’re going to face a great team, whoever it is, and we’re going to have to be ready to play,” Bregman said. “But I’ll tell you this, the game that we just won is going to prepare us a lot for those crucial moments during the next series.”

The Yankees, who fended off elimination in New York on Sunday, hosted the Indians again later on Monday.

- Cubs take control -

Anthony Rizzo of the Chicago Cubs hits a single in the eighth inning against the Washington Nationals during game three of the National League Division Series at Wrigley Field on October 9, 2017

National League action resumed on Monday as the World Series champion Chicago Cubs gained the upper hand in their NL division series with a 2-1 win over the Washington Nationals.

The victory put the Cubs up 2-1 in the best-of-five series with a chance to close it out at Wrigley Field on Tuesday.

Anthony Rizzo put the Cubs ahead in the eighth inning with a run-scoring single to shallow center field. Cubs closer Wade Davis pitched a scoreless ninth to preserve the win.

Nationals starting pitcher Max Scherzer held the Cubs hitless for 6 13 innings before surrendering a double to Ben Zobrist in the seventh. Albert Almora followed with a run-scoring single off of reliever Sammy Solis that tied the game at 1-1.

Ryan Zimmerman had put the Nats up 1-0 in the sixth with a run-batted-in double.

Later Monday, the Los Angeles Dodgers tried to close out the Diamondbacks in Arizona after winning two at home.