BALTIMORE -- The New York Yankees stumbled into home-field advantage in the AL wild-card game, falling to the Baltimore Orioles 9-4 Sunday after a loss by Houston made the outcome meaningless.
New York will enter Tuesday's winner-take-all game against the Astros with little positive momentum after being swept in three games by Baltimore and losing six of their final seven regular-season games. the Yankees fell behind 7-1 in the fifth inning and stranded 11 runners.
New York was 4 for 31 with runners in scoring position in closing series, including 1 for 12 Sunday.
After clinching a playoff berth on Thursday, New York needed just one win at Camden Yards to assure itself a game at Yankee Stadium on Tuesday. That victory never came, but that's partly because manager Joe Girardi tried to balance the importance of winning against resting his starters and relievers.
"It's tricky," Girardi said before the game. "I need to think about certain people."
Fortunately for the Yankees, Arizona's 5-3 victory over Houston ended the Astros' bid to host on Tuesday. Had New York (87-75) and the Astros (86-76) finished tied, Houston would have won the tiebreaker for home field based on head-to-head record.
Yankees starter Michael Pineda (12-10) lasted only 3 2-3 innings, allowing four runs and six hits. The right-hander has yielded a total of 11 runs in his last two outings.
Eight relievers followed, none of whom pitched more than an inning.
Major league home run leader Chris Davis connected twice for Baltimore, giving him 47 for the season. He also struck out for the 208th time, fifth-most in one season in big league history.
Playing perhaps his final game with the Orioles, Davis hit a two-run shot off Bryan Mitchell in the fifth and a two-run drive against Caleb Cotham in the eighth. The slugger will enter free agency coming off a season in which he drove in 117 runs.
Chris Tillman (11-11) gave up two runs and seven hits over 5 1-3 innings to level his lifetime record against New York at 6-6.
The sweep gave Baltimore a 10-9 record against New York this year. After going 13-6 last year, the Orioles have won successive season series against the Yankees for the first time since 1981-82.
Baltimore finished 81-81 after winning the AL East last year with a 96-66 record. Although they missed the playoffs, the Orioles were in contention for a wild-card berth until the final week and closed with a five-game winning streak to avoid what would have been their first losing season since 2011.
Orioles third baseman Manny Machado failed to homer in a fifth consecutive game but completed the season as the only player in the majors to participate in all 162 games.
Baltimore went up 2-0 in the first inning when pending free agent Matt Wieters hit a two-run, two-out single.
Doubles by Greg Bird and Didi Gregorius got New York a run in the second before the Orioles chased Pineda with a three-run fourth.
After Wieters doubled and scored on a two-out single by J.J. Hardy, Ryan Flaherty greeted Chris Capuano with a line drive that bounced off the mound and went into left field for a double. Two batters later, Gerardo Parra delivered a two-run single.
Orioles: CF Adam Jones (back) and 2B Jonathan Schoop (hand) watched from the dugout, although manager Buck Showalter said, "Both are capable of doing something for us today."
Yankees: New York will send right-hander Masahiro Tanaka (12-7, 3.51 ERA) to the mound on Tuesday.
Orioles: Baltimore heads into an important offseason uncertain if this was the final game as Orioles for pending free agents Wieters, Davis, Darren O'Day and Wei-Yin Chen.