Manny Machado hit a two-run homer off Dellin Betances with two outs in the bottom of the ninth inning, capping a comeback that lifted the Baltimore Orioles past the New York Yankees 7-6 on Tuesday night.
Betances (3-6) retired the first two batters in the ninth before Tim Beckham walked. Machado then drove a 1-0 pitch far over the center-field wall to provide the Orioles an unlikely victory after New York scored six runs in the third.
It was Machado's second homer of the game and team-high 32nd of the season. Jonathan Schoop and Mark Trumbo also went deep for the Orioles, who closed within a half-game of Minnesota for the second AL wild card.
Zach Britton (2-0), Baltimore's sixth reliever, worked the ninth.
New York started the game 2 1/2 games behind Boston, which beat Toronto 3-2 in 19 innings, in the AL East and is the top AL wild card.
The Yankees were poised to capture their first series at Camden Yards since September 2013, but now to do that they'll have to win Wednesday night in the deciding matchup of the three-game set.
New York starter CC Sabathia allowed five runs and eight hits over 5 1/3 innings. He left with the lead, but was betrayed by the bullpen in his bid to earn his first victory in seven starts against Baltimore since May 2016.
The start of the game was delayed by rain for 2 hours, 14 minutes. A good portion of the announced crowd of 14,377 stuck around, and for the Orioles fans it proved worth the wait.
New York trailed 2-0 before turning things around in the third inning against Jeremy Hellickson (2-4). After Didi Gregorius singled in two runs, the Yankees loaded the bases for Greg Bird, who hit a fly to center. The ball plopped in and out of Adam Jones' glove, allowing a run to score, and two batters later Jacoby Ellsbury singled in two unearned runs.
Hellickson gave up five runs, three earned, and only two hits. But he walked four and hit a batter.
Schoop hit a solo homer in the fifth and Trumbo got Baltimore to 6-5 in the sixth with a two-run drive.
Yankees: Recalled 1B Tyler Austin from Triple-A Scranton/Wilkes-Barre. Austin is hitting .233 with two homers and seven RBIs in 10 games with the Yankees this season.
Orioles: Purchased the contract of OF Austin Hayes from Double-A Bowie and designated LHP Jayson Aquino for assignment.
Orioles: The team isn't ready to activate SS J.J. Hardy (wrist) from the 60-day DL until he further tests his ailing elbow swinging the bat.
Yankees: RHP Sonny Gray (8-9, 3.36 ERA) faces Baltimore for the first time since 2015. Since being traded from Oakland, he's 2-4 and has allowed five homers in six games.
Orioles: Kevin Gausman (10-9, 4.79 ERA) hasn't given up a run in his last two starts, covering 13 2/3 innings. His ERA is at its lowest since April 13.