Brandon Barnes led off the ninth with a single against Rivera, and he was trying to steal second base when Matt Dominguez lined out to second baseman Robinson Cano for an easy double play, ending the rally. Rivera ended the game moments later, nailing down the Yankees' 5-4 win.
"If we continue to play the way we played tonight, we will win a lot of ballgames," Astros manager Bo Porter said. "That's a good ballclub over there and they won the game, but at the same time, we played the game the way it's supposed to be played and put ourselves in position to have the opportunity to win, as well."
Barnes laced a single into left field for the Astros' first hit against Rivera in 14 all-time at-bats against him, and the speedster was on the move towards second when Dominguez hit a floater that found the glove of Cano right behind second. What looked like a possible hit to move the tying run to third was instead a double play.
"I didn't barrel it, but I thought I hit it pretty good and could get it over his head," Dominguez said. "He made a good play, and things just aren't going our way right now."
Porter said Barnes has the green light to go when he pleases.
"The aggression was great and everybody executed to perfection, but it just so happened the ball ends up being lined to Cano and then the double play," he said.
Left-hander Erik Bedard couldn't make it past the fourth inning once again, leaving with a 4-0 deficit before the Astros rallied to bat around in the fourth and tie the game. The Yankees pushed a run across in the sixth on a double-play grounder and were able to turn the ball over to Rivera in the ninth.
Astros reliever Paul Clemens (1-1) took the loss. He threw a dazzling 1-2-3 fifth in relief of Bedard, then allowed a leadoff double to Eduardo Nunez in the sixth. With runners at first and third with one out, he coaxed Ichiro Suzuki to hit a potential double-play grounder to second.
Second baseman Jose Altuve didn't have a play at the plate, so he threw Ichiro out at first before the Astros threw to second to get Lyle Overbay, but not before the go-ahead run scooted home to put the Yankees ahead, 5-4.
"I wanted to come in and lock it down for my team," Clemens said. "Unfortunately, I made a mistake to Nunez and paid for it, but like I said, I want to sit on this feeling for a little bit. I don't enjoy letting my team down and I'm going to sit on this for tonight and get ready for the next one."
Yankees manager Joe Girardi gave credit to Overbay for not running into Altuve's tag and making him throw to get Ichiro out at first, which allowed time for Nunez to score.
"Very smart," he said. "It takes a heads-up player to realize don't get tagged and allow the double play to happen that way."
Bedard needed 90 pitches to throw four innings while allowing four runs, four walks and six hits. He's 0-2 with a 7.98 ERA in five starts with the Astros this year and hasn't thrown past the fourth inning. Fifteen of the 24 hits he's allowed this season have gone for extra bases.
"Deep counts again," Porter said. "The base on balls really hurt us early, and that kind of got his pitch count going. I'll tell you what, Clemens came in and did a great job and kind of held it at bay. The bullpen did everything we could ask of them to keep it right where it was at. We had some great opportunities, and those guys made some plays when they needed to make them."
Yankees starter David Phelps retired eight of the first nine batters he faced before the Astros batted around in the fourth. Carlos Pena hit an RBI single, Fernando Martinez was hit by a pitch with the bases loaded, Barnes beat out a potential double-play ball to drive in a run and Dominguez made it 4-4 with an RBI single.
"We get the kind of effort and play baseball the way we've played here these last three games, we're going to win a lot of games," Porter said.