The Rays got themselves right in time to salvage a win. Ji-Man Choi put Tampa Bay ahead with a two-run double in the seventh, Travis d'Arnaud homered and drove in four, and the Rays beat Houston 9-8 to avoid a three-game sweep.
Now Tampa Bay heads home for a pivotal 10-game homestand that starts against the Indians on Friday night.
''We were all pumping each other up the whole game, every lead change, we weren't pouting or anything,'' d'Arnaud said. ''We ended up on top, which was huge.''
Astros star Jose Altuve hit a tiebreaking solo leadoff homer in the sixth, his 25th, but Tampa Bay scored three runs in the seventh to make it 8-6. Tommy Pham had an RBI single off Chris Devenski (2-3), and Choi brought in two more with a drive to center.
Houston ended a seven-game winning streak.
''You get a close game like that - and certainly, a crazy game like that - you always look back at the opportunities,'' Astros manager AJ Hinch said. ''We didn't play particularly clean, but we did fight and I love the fight. It was a weird back-and-forth game, but we didn't do quite enough at the right times to win the game.''
The Rays used seven pitchers, including opener Andrew Kittredge and long man Trevor Richards, who combined to allow four hits and two runs in the first three innings. Jose De Leon (1-0) pitched a scoreless inning, and Emilio Pagan earned his 15th save.
The Rays and Astros exchanged solo homers in the third, with Austin Meadows hitting his 24th and George Springer answering with his 28th to make it 2-2.
D'Arnaud put Tampa Bay up 4-2 with a two-run homer in the fourth and added an RBI single in the sixth to tie it at 5.
Zack Greinke had won four straight starts since joining Houston prior to the July 31 trade deadline. He got a no decision after allowing five runs and six hits in 5 2/3 innings while striking out eight and walking one.
''I felt pretty good out there, but everyone that got on seemed to score,'' Greinke said. ''And I made a bad pitch for the two-run homer. Everything about it was bad. It's kind of frustrating. I lost the game. I gave up more runs than I would've liked, especially when you're feeling pretty good.''
The Astros drew three bases-loaded walks over the fourth and fifth innings to take a 5-4 lead but left the bases loaded in both frames. Houston stranded 11 runners total.
Houston again pulled within one run when Josh Reddick made it 8-7 with an RBI single in the seventh. The Rays answered with a fielder's choice grounder from Meadows to make it 9-7.
Abraham Toro led off the bottom of the ninth with his first career homer to make it 9-8 before the Rays held on. Reddick was ejected in the ninth after arguing a strikeout call.
Rays: OF Kevin Kiermaier (left rib cage contusion) remained out of the lineup for a third consecutive game as Cash said he's still in ''a significant amount of pain.'' Cash said he's optimistic he can avoid the injured list and possibly return Friday. ... RHP Tyler Glasnow (right forearm strain) will begin a rehab assignment Friday and is scheduled to pitch one inning or 20 pitches for Class A Charlotte. Glasnow has been out since May 11.
Astros: RHP Josh James (shoulder) will make what Hinch said he hopes will be his last rehab outing at Triple-A Round Rock. James will be evaluated Friday to see if he needs another rehab outing. . SS Carlos Correa (back) still hasn't begun swinging and will not travel with the team on its upcoming road trip. ... RHP Ryan Pressly (knee) has been doing soft throwing and keeping his arm strength up. Pressly had right knee arthroscopic surgery and is expected to be out four to six weeks. ... Hinch said neither RHP Brad Peacock (shoulder) nor RHP Aaron Sanchez (pectoral) will play catch during the upcoming road trip.
Choi, a first baseman, made a dazzling over-the-shoulder catch in shallow right field to hold Tampa Bay's 8-7 lead. Through a translator, Choi said he was happy to be able to make the critical catch because he was starting to get a cramp in his neck, looking at the ball from an awkward angle.
Rays: No starter has been announced for Friday's series opener at home against Cleveland.
Astros: LHP Wade Miley (13-4, 3.13 ERA) will face the Blue Jays for Friday's season opener in Toronto.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.