WEST SACRAMENTO -- Did a rookie outfielder save the Astros’ season on Thursday night?

That could be the case for 23-year-old , who became the third player in Major League history to hit his first three career homers in the same game -- including a solo shot in the seventh that broke a tie -- en route to driving in five runs to send the Astros to a crucial 7-5 win over the A’s at Sutter Health Park.

The win kept the Astros (79-80) in a first-place tie atop the American League West with the Rangers, who beat the Mets earlier Thursday. The Astros have the tiebreaker over Texas and continue to control their own destiny with three games remaining in the regular season. Houston has three more against the A’s, while Texas begins a three-game series at the Twins on Friday.

Spence’s second homer of the game put the Astros ahead, 5-4, in the seventh inning, and Christian Walker slammed Houston’s fourth homer of the night in the eighth to make it 6-4. That loomed large because Zack Gelof hit his second solo homer of the game, off Bennett Sousa, in the eighth. Spence led off the ninth with a first-pitch homer to right field.

Spence joins Joshua Báez of the Cardinals, who homered three times in his Major League debut Aug. 15, and Seby Zavala of the White Sox (July 31, 2021) as the only players to hit their first three career homers in the same game.

Spence, recalled from Triple-A Sugar Land on Wednesday because of Daulton Varsho’s wrist injury, hit a combined 12 home runs this season combined at Sugar Land and Double-A Corpus Christi, where he began the season. This is the second stint in the big leagues this season for Houston’s No. 12-ranked prospect by MLB Pipeline, who was an undrafted free agent out of Southern Illinois-Edwardsville in 2024.

Spence’s first career home run, a three-run shot in the second off starter Mason Barnett, put Houston up, 3-0. The A’s answered with four runs in the third off Astros starter Peter Lambert, who gave up back-to-back homers to Jeff McNeil -- a three-run shot -- and Gelof.

Lambert lasted only 2 2/3 innings, marking the third consecutive game in which an Astros starting pitcher didn’t finish the third inning. Rookie reliever Miguel Ullola, who threw 33 pitches in two innings of work Tuesday, threw three scoreless innings on 35 pitches Thursday to rescue Houston’s taxed bullpen.

The Astros didn’t manage another hit off Barnett following Spence’s first homer until the sixth inning, when Isaac Paredes homered to left field to tie the game. That was the 24th homer of the season for Paredes, who is second on the club with 93 RBIs.