SAN DIEGO — George Springer and José Altuve keyed a four-run rally in the fifth inning, Framber Valdéz pitched six brilliant innings, and the Houston Astros beat the Tampa Bay Rays for the third straight game 7-4 on Friday to force a deciding Game 7 of the AL Championship Series.

Houston chased starter Blake Snell in the fifth before Springer hit a go-ahead, two-run single and scored on Altuve’s double. Carlos Correa, who hit a walkoff home run in Thursday night’s 4-3 win, added an RBI single.

The Astros are one win away from advancing to their third World Series in four seasons and joining the 2004 Boston Red Sox as the only teams to rally from a 3-0 deficit to win a seven-game series. The Red Sox stunned the New York Yankees to win the ALCS before winning their first World Series in 86 seasons.

Otherwise, big league clubs leading 3-0 in a best-of-seven postseason series are 37-1.

Houston also is trying to become the first team to win a pennant with a losing regular-season record (29-31).

Manuel Margot homered twice and drove in three runs for the Rays, who — after blowing the 3-0 series lead — remained one win away from their second World Series appearance in franchise history and moved within one loss from joining the 2004 Yankees in ignominy.

Game 7 tonight will feature the pitchers who started and finished Houston’s Game 7 win against the Los Angeles Dodgers in the 2017 World Series. Right-hander Lance McCullers Jr. will go for the Astros, and 36-year-old Charlie Morton is expected to start for the Rays. In the decisive Game 7 in 2017, McCullers started and went 2 1/3 scoreless innings for the Dodgers while Morton pitched the final four innings for the Astros and got the win. Morton signed with Tampa Bay prior to the 2019 season.

It’s also a rematch of Game 2 of this series, won 4-2 by Morton and the Rays.

Valdéz (3-1), who lost the opener of this series 2-1 to Snell (2-2), held the Rays to one run and three hits while striking out nine and walking three in his third career postseason start. He allowed Willy Adames’ RBI double to left in the second.

Astros closer Ryan Pressly pitched for the third straight day and got three outs for his second save to go with a win in Game 5. He allowed Yoshitomo Tsutsugo’s one-out single, then induced Mike Brosseau’s game-ending double-play grounder, a call upheld in a video review. Pressly threw nine pitches, all for strikes, raising his three-day total to 39.

Dusty Baker, the Astros’ 71-year-old skipper who led NL teams for the first 22 seasons of his 23-year managerial career, used some old-school baseball to outfox 42-year-old counterpart Kevin Cash and overturn a 1-0 deficit in the fifth inning. The Astros had been frustrated in the first three games when they scalded balls right to fielders, but this rally had only one hard-hit ball.

Snell walked Yuli Gurriel opening the fifth and allowed a single to Aledmys Díaz on his 82nd pitch. Cash, whose team was built around analytics, pulled Snell before he could face No. 9 batter Martín Maldonado and Springer, who had struck out twice.

Maldonado laid down a sacrifice bunt against Diego Castillo, and Springer punched a two-run single to center through a hole in Tampa Bay’s drawn-in infield that was also in a shift. Altuve followed with a double into the left-field corner that brought in Springer, who might have been out if Brandon Lowe had hit the cutoff man.

After Michael Brantley walked, Correa singled to left to bring in Altuve.

Snell allowed two runs and three hits in four-plus innings, struck out four and walked four.

Baker is the first manager to take five franchises to the playoffs. He has yet to win a World Series as a manager. His San Francisco Giants reached the 2002 Fall Classic before losing in seven games to the Angels. As a player, he helped the Los Angeles Dodgers win the World Series in 1981 against the New York Yankees.

Houston’s Kyle Tucker homered off rookie Shane McClanahan leading off the sixth. In the seventh, Michael Brantley hit an RBI single and Tucker had a sacrifice fly.

Margot homered off Andre Scrubb leading off the Rays’ seventh and hit a two-run shot off Cristian Javier with two outs in the eighth.