New York's comeback followed sharp outings by five relievers, including winning pitcher Jacob Lindgren, who hurled a scoreless top half of the ninth.
Dallas Keuchel started for Houston and turned in a solid tune-up for his Opening Day assignment, spinning 4 1/3 scoreless innings of four-hit ball with three strikeouts. Keuchel threw 58 pitches, 41 for strikes.
Chris Carter provided Houston with a quick lead by belting his first homer of the spring, a two-run blast to dead center field off Yanks right-hander Michael Pineda in the first inning.
Yankees center fielder Chris Young lost his glove while trying to bring the homer back, and left fielder Brett Gardner scaled the fence and retrieved both the glove and the ball, drawing a standing ovation from the crowd.
"The fence wasn't that high," Gardner said. "It wasn't like I was jumping over the Green Monster or anything. Whatever; I've done it before."
Pineda settled down after permitting three hits in a shaky first inning, striking out six over 3 2/3 innings. Pineda scattered four hits in all and did not issue a walk, throwing 42 of 56 pitches for strikes.
"I'm happy because today is a good outing. I'm feeling good," Pineda said. "This is very important for me. I'm feeling great."
Former No. 1 overall Draft pick Mark Appel pitched three hitless innings of relief for the Astros, striking out two and walking one.
Up next: CC Sabathia will make his second spring start on Sunday, traveling across the state to face the Mets at Tradition Field in Port St. Lucie, Fla. He will be pitching in front of the Yankees' starting infield of Mark Teixeira, Stephen Drew, Didi Gregorius and Chase Headley. Matt Harvey will be on the mound for the Mets, with first pitch scheduled for 1:10 p.m. ET. on MLB.TV.
Bryan Hoch is a reporter for MLB.com. Follow him on Twitter @bryanhoch and read his MLBlog, Bombers Beat. This story was not subject to the approval of Major League Baseball or its clubs.