First, they were unable to do much against Justin Verlander Monday, and Tuesday they were three outs away from a close loss highlighted by strikeouts and errors.
Now the Yankees are in a position to win the series thanks to rookie second baseman Gleyber Torres.
After Torres delivered the game-winning single in the 10th inning on Tuesday, the Yankees conclude their season series with the Astros Wednesday.
New York is 4-2 against the defending champions and three of those wins occurred in its last at-bat, including Tuesday's 6-5 triumph. None of the wins, however, seemed as unlikely as Tuesday when the Yankees committed five errors for the second time in the last decade and won when doing so for the fourth time since 1960.
"We didn't play our best baseball," said Yankees left fielder Brett Gardner, whose tying homer in the ninth forced extra innings. "Anytime you make five errors and can hang around and sneak away with a win, you'll take it."
The Yankees are in a position to win for the 17th time in their last 21 home games before starting a 12-game road trip because of Torres, who is hitting .321 with nine homers and 26 RBI in his first 32 games since joining the team on April 22.
"It's obvious the talent he has," catcher Gary Sanchez said through an interpreter. "He's just showing what he's able to do."
Whatever Torres does in his next game, it will likely be from the ninth spot in the lineup. Torres batted fifth Monday against Verlander but returned to hitting ninth Tuesday.
"I don't have any apprehension on moving him because I think he's a good hitter and I think he'll be comfortable wherever we put him and it just kind of depends on how we match up," Yankees manager Aaron Boone said. "But I do like him in the nine-hole because of the length of our lineup and the quality of hitters."
The Astros will be attempting to get their 15th win in 21 games and rebound from a second bullpen collapse this week. On Sunday, the relievers coughed up a five-run lead in an eventual 14-inning loss at Cleveland, and on Tuesday Chris Devenski could not protect a 5-3 lead.
"The matchups didn't hurt us, I think the execution did," Houston manager A.J. Hinch said. "We had a tough time finishing a few hitters that paid off big for them but obviously our bullpen's been beat up a little bit.
"We had a number of guys that we weren't going to use tonight. That was changing as the game was going. You feel it a little bit on a night like this."
Among those not available Tuesday was closer Ken Giles, whom Hinch said was not available until after the 10th.
The Astros will hope if it's a close contest Wednesday, Dallas Keuchel (3-6, 3.39 ERA) can help get the game to Giles.
Keuchel is the only Houston starter with a losing record but he leads the American League with a groundball rate of 57.7 percent.
Keuchel is 2-2 with a 2.73 ERA in his last five outings, including May 2 when he was on the losing end of a 4-0 decision to the Yankees in Houston.
He allowed two homers to Giancarlo Stanton among three runs and six hits in seven innings.
Including the postseason, Keuchel is 6-4 with a 1.82 ERA in 10 appearances against the Yankees. He is 4-2 with a 2.09 ERA in six starts at New York.
On Friday, Keuchel allowed two runs on eight hits in six innings in an 11-2 win at Cleveland when the Astros scored all their runs in the eighth and ninth.
The Yankees are hoping Luis Severino (7-1, 2.28 ERA) is as good as his last outing against the Astros four weeks ago in Houston. On May 2, he pitched a five-hitter with 10 strikeouts on 110 pitches.
Severino tossed his first-career complete game by averaging 98.3 mph on his 60 four-seam fastballs, 88.7 mph on his 34 sliders and 88.6 mph on his 16 changeups.
Severino's performance in Houston is part of a run of eight straight starts without a loss that continued when he allowed one run on four hits in six innings of a 2-1 win over the Los Angeles Angels. Since his loss in Boston on April 10, Severino is 5-0 with a 1.87 ERA.
He is 1-1 with a 4.34 ERA in four regular-season appearances (three starts) against the Astros.
Severino will likely face shortstop Carlos Correa. Correa, who is hitting .196 (18-for-92), was given Tuesday off but is expected to play Wednesday.