Teixeira, playing in his second spring game after missing most of last season due to wrist surgery, led off the third inning with a long double off reliever Darin Downs. Johnson hit the next pitch for his first homer.
It was his first hit since June 11.
Teixeira played 4 1-2 innings at first base and went 1-for-2 with a walk while ''continuing to knock off some rust, get my legs in shape, get my swing in shape,'' he said. ''I was glad I saw a walk today. That was a good step for me, just seeing pitches.''
Teixeira was also happy to get some swings from both sides of the plate.
''I like doing that in spring training because we have days off, and sometimes pitchers are changing so much,'' he said. ''You can go two or three games without facing a left-handed pitcher. I'll go a week without hitting right-handed.''
Chris Carter hit a three-run homer for the Astros, and Jose Altuve had two hits and scored twice.
Ivan Nova gave up three runs and eight hits in four innings in his second spring start for the Yankees. Carter's first spring home run came off Manny Banuelos, the 23-year-old left-hander who didn't pitch last season after having elbow surgery.
Chase Whitley got the win after striking out the only batter he faced. Jose Cisnero took the loss after giving up three hits in New York's three-run sixth.
Houston manager Bo Porter lost his first replay challenge. Yankees manager Joe Girardi remained 0-0 on challenges after going out to talk over whether Brett Gardner's line drive had actually been caught by Astros left fielder L.J. Hoes in the fourth inning.
''I went out there to see what they saw, and they decided to huddle, so I really didn't have to do much,'' Girardi said.
Porter challenged an out call at first base after Teixeira fielded Jonathan Villar's second-inning bunt and tossed the ball to Eduardo Nunez covering first base. Porter challenged whether Nunez's foot was on the bag. The call was upheld within seconds.
''We decided, with this being the first game in which we actually had replay that it's a close call, and you want to go out there and test the system,'' Porter said.
YANKEES: Nova gave up four hits and two runs in the first inning because he got too many pitches up, he said.
ASTROS: Jarred Cosart was lifted with two outs in the second inning after throwing 51 pitches. He gave up two runs, one earned.
YANKEES: Girardi said an MRI exam on Brendan Ryan (back) came back good and that the infielder will be out a few days. ''We think he'll be fine,'' Girardi said. ''Probably being a little cautious.''
ASTROS: Caution is also the word for pitcher Mark Appel, who is recovering from an appendectomy in January and ''hasn't gotten back on the mound yet,'' according to Porter, since throwing 22 pitches off a mound early in camp.
Japanese star pitcher Masahiro Tanaka will make his next start for the Yankees on Tuesday in a simulated game.
The format - featuring just a pitcher, catcher and hitter - will be another new experience for the right-hander compared to spring training in Japan.
''It's actually a little different from here,'' Tanaka said through an interpreter. ''They had an actual game inside the team. Intrasquad game. This is something new. It's part of the adjustment here.''
Tanaka has made two exhibition game appearances, allowing one run, four hits and striking out four over five innings. He had a 33-pitch bullpen session on Saturday, and is scheduled to pitch March 16 against Atlanta.
Tanaka said the major difference between spring training in Japan and the United States is that the Yankees' workouts are shorter.
New York ace CC Sabathia will start Tuesday against Washington in Viera, Fla. The left-hander also had a mound session and continued working on his new cut fastball.