BALTIMORE — The Yankees did their best to blow another one on Wednesday, but Brett Gardner — and the Orioles — wouldn’t let them leave Camden Yards without a much-needed victory.
Gardner’s two-run single in the top of the ninth gave the Yankees the lead, and they held on in the bottom of the inning to beat Baltimore, 4-3, and keep pace in the AL wild-card race.
Aroldis Chapman retired the side in order in the bottom of the inning, allowing the Yankees to remain tied with Toronto and percentage points ahead of the Red Sox, both of whom also won Wednesday.
The Yankees were in deep trouble after another Gleyber Torres error prolonged the bottom of the eighth and Chad Green gave up a homer in a third straight appearance to put the Yankees in a one-run hole.
But Baltimore fell apart in the ninth.
Luke Voit led off with a walk against Tyler Wells and was replaced by pinch-runner Tyler Wade.
Torres singled, sending Wade to second, before Gary Sanchez — who had nearly homered earlier in the game — flied out to center.
With Gardner at the plate, the Yankees pulled off a double steal, as Wade beat the throw to third and Torres got to second.
As the skies opened up and Baltimore brought the infield in, Gardner lofted a single to center to drive in both runners.
Gio Urshela then grounded one to shortstop, which was booted for an error. A wild pitch by Dillon Tate sent the runners to second and third, but DJ LeMahieu grounded to second and Gardner was out at home. Aaron Judge followed with a grounder up the middle, where Pat Valaika made an excellent play to end the inning and prevent another run from scoring.
The rally bailed out the struggling Green and Torres, who both had ugly eighth innings.
Green came on in the seventh with the Yankees holding a one-run lead and got the final two outs.
In the eighth, Green gave up a leadoff single to Austin Wynns, but got Cedric Mullins to hit a liner to Torres at second.
Torres dropped it, but instead of getting the force at second, inexplicably threw to first for the out — allowing Wynns to get to second — just adding to Torres’ bad run in the field that could wind up ending his time in The Bronx.
Green came back to strike out Ryan Mountcastle and got ahead of Austin Hays 0-2 before Hays took him deep, giving Baltimore a 3-2 lead — briefly wasting an outstanding performance from Nestor Cortes Jr., who gave up just one run and struck out a career-high 11 in 6 ¹/₃ innings.
The Yankees were also victims of some bad luck.
Sanchez nearly gave the Yankees a 2-0 lead in the top of the second. After Torres walked with two outs, Sanchez came up and blasted a shot deep to center that seemed to be a sure two-run homer, but Mullins made an incredible leaping catch at the wall to rob Sanchez — leaving both teams in disbelief.
The Yankees broke through against Baltimore’s top starter, John Means, in the third. Gardner led off with a single and Urshela followed with his 12th homer of the season and first since July 4.
Cortes rolled early. After retiring the first four batters, he put runners on first and second with two outs in the second before fanning Kelvin Gutierrez.
He went on to retire eight in a row before Valaika singled with one out in the fifth, but Cortes got some help from Urshela later in the inning.
Urshela, at shortstop with Torres having been shifted back to second, made a terrific diving play to his right on a low liner from Wynns to end the inning.
Cortes looked overpowering — or as overpowering as a pitcher can be when topping out at 93 mph — having allowed just two hits as he headed into the sixth.
After consecutive strikeouts of Mullins and Mountcastle to start the sixth, Hays took Cortes deep to cut the Yankees’ lead to 2-1.
Sanchez missed out on at least a single leading off the seventh when Gutierrez snared his liner to third.
Gardner followed with a shot to right-center that he was able to stretch into a double, just beating the throw from Mullins. He moved to third on a groundout by Urshela, but was stranded when LeMahieu lined out to right.
Cortes got the first out in the bottom of the seventh before he walked Valaika on four pitches to end his night and Aaron Boone went to Green.