BALTIMORE - You saw that one coming, right?

Of course you didn't. Maybe even Stephen Drew didn't, either.

Joe Girardi, on the other hand, must have sensed something when he sent the struggling infielder to the plate as a pinch hitter for the injured Brett Gardner with the Yankees trailing by two, two outs and the bases loaded in the seventh inning Monday night.

Drew, hitting .150 with a .182 on-base percentage entering the game, emphatically delivered.

After getting ahead of righthanded reliever Tommy Hunter 3-and-1, Drew launched the next pitch well over the wall in right-center to put the Yankees ahead for good in a back-and-forth 6-5 victory over the Orioles in front of 21,633 at Camden Yards.

After a 2-4 homestand to start the season, it was an encouraging start to a 10-game, three-city trip, though the condition of Gardner, who left the game with a stiff right wrist, quickly could make things discouraging.

Gardner was hit by a pitch on the wrist in the first inning. An X-ray Monday night was negative, though the wrist still bears watching.

The Yankees (3-4), who also got homers from Chris Young and Mark Teixeira, entered the seventh down 4-2, the result of Adam Jones' two-run homer off Michael Pineda in the sixth. Pineda (1-0) struck out nine and walked none but allowed five runs and nine hits in 61/3 innings.

Manny Machado led off the seventh with a single. After Jonathan Schoop struck out, Everth Cabrera singled to end Pineda's night as Girardi called for Dellin Betances. The righthander allowed a single to Caleb Joseph to load the bases and Alejandro De Aza's 4-6 forceout made it 6-5 as Machado scored.

Betances, who struggled throughout spring training, came out for the eighth and allowed a leadoff single to Jones, who was caught stealing by John Ryan Murphy, who threw out two runners in the game. But after Betances walked Travis Snider, Girardi called on lefthander Andrew Miller to face the righthanded-hitting Machado. Miller struck out Machado and the righthanded- hitting Schoop to end the inning.

Miller, clearly emerging as Girardi's choice to close games, pitched a scoreless ninth to record his second save.

Young, whose second homer of the season in the second off Wei-Yin Chen gave the Yankees a 1-0 lead, started the seventh-inning rally against Hunter with a single. Murphy walked but Hunter (0-1) got Didi Gregorius and pinch hitter Garrett Jones to fly out.

Jacoby Ellsbury, however, reached on an infield single to load the bases and Girardi, with switch hitter Chase Headley available, tabbed Drew.

Drew jumped on Hunter's 95-mph fastball for his second homer of the season to make it 6-4.

The Yankees trailed 2-1 in the fourth before Teixeira drew them even, driving Chen's 1-and-1 fastball, which came in at 90, high into the night for his team-best third homer.

Pineda's sixth started with De Aza doubling down the rightfield line and going to third on Steve Pearce's groundout to first. Pineda struck out the always dangerous Chris Davis with a nasty full-count slider and got ahead of Jones 1-and-2 before he blasted his third homer of the season.

It had the appearance of a game-winner for Baltimore -- right up until Drew's surprising moment.