NEW YORK — David Robertson picked a bad time to have his worst outing in a long while.
The closer walked consecutive batters and threw seven straight balls before Carter, who struck out in all four previous at-bats, launched a 3-0 pitch into the raised concrete bleachers in left field for his 30th home run.
"I tried to make a good pitch down and away. Instead, I threw it right into his bat path and he put it 30 rows deep," Robertson said. "I struggled out there tonight and I blew it for our team."
Robertson (1-4) had gone 27 games without giving up a home run since Josh Willingham connected for Minnesota on June 1 at Yankee Stadium. The right-hander has converted 21 consecutive save chances, the longest active streak in the majors.
"The law of averages are finally going to catch up to you," teammate Mark Teixeira said. "I mean, he's been so good, so every now and then you have a hiccup."
Brian McCann hit a two-run homer, and Martin Prado had three hits for the Yankees, who went 1 for 9 with runners in scoring position and lost for the sixth time in eight games. They fell four games out of an AL playoff spot.
"We were able to come back and tie the game up and we let it slip away," manager Joe Girardi said.
It was a costly defeat for New York, which began a six-game homestand against two teams with losing records, the Astros and Chicago White Sox.
"We're not going to let one game get us down too much. I'm pretty sure we're still in the race. We've just got to score more runs and win more games," Teixeira said.
Marwin Gonzalez knocked in two runs with a pinch-hit single, and the fourth-place Astros (53-73) won for the third time in four meetings with the Yankees this year. Despite a $154 million difference in opening-day payroll, Houston took two of three at home against New York to begin the season.
"Shows us that we're on the right track," winning pitcher Josh Fields said. "We're playing a lot better baseball than last year."
Carter, the reigning AL player of the week, is batting .340 with eight homers and 19 RBIs in his past 13 games. He leads the majors with 17 home runs and 42 RBIs since July 1.
"It was like somebody flipped a light switch," Fields said.
Chad Qualls worked a perfect ninth for his 14th save.
Prado singled in the fourth off starter Brett Oberholtzer before McCann drove an 0-2 pitch into the second deck in right for his 14th homer.
Robbie Grossman hit a two-out RBI single in the fifth, and Houston chased Chris Capuano on his 36th birthday during a three-run sixth. Fowler led off with a triple and scored on Jason Castro's tying groundout. After consecutive singles, both runners moved up when Jake Marisnick's groundout deflected off reliever Adam Warren.
Astros manager Bo Porter pushed the right button, lifting No. 9 batter Gregorio Petit for a left-handed hitter even though Petit had doubled both times up. Gonzalez hit a two-run single that gave Houston a 4-2 lead.
Prado tied it in the bottom half with a two-run double that ended Oberholtzer's night.
ON THE GREEN
Tiger Woods was on the field during batting practice before heading to the runway behind the Yankees dugout, where the golf star greeted injured New York pitcher Masahiro Tanaka and then Astros outfielder Dexter Fowler.
Astros: 1B-OF Jesus Guzman was activated from the disabled list, and LHP Darin Downs was placed on the 15-day DL, retroactive to Aug. 15, with a strained muscle on his right side. Guzman had been sidelined since Aug. 2 because of back spasms.
Yankees: Tanaka (elbow) plans to throw another bullpen Wednesday. ... Girardi said a decision on whether to use RHP David Phelps (elbow inflammation) as a starter or reliever when he gets back probably will depend on how long he is out.