NEW YORK (AP) -- Masahiro Tanaka labored through a 31-pitch first inning against Baltimore, the team with the worst record in the major leagues, falling behind his first four batters.
"Hopefully we make it out of this soon," catcher Kyle Higashioka recalled thinking. "You never want to get to the bullpen early."
Tanaka stranded a pair of runners when Chris Davis grounded to second baseman Gleyber Torres in short right field, and the 29-year-old Japanese right-hander regained his command. He pitched six scoreless innings to extend his unbeaten streak to 13 starts , backed by Miguel Andujar's three-run homer in the Yankees' 6-3 win Tuesday night over the veteran-shedding Orioles.
New York (68-37) moved 31 games over .500 for the first time since the end of the 2011 season, beating the Orioles for only the sixth time in 11 meetings this year. The Yankees cut their AL East deficit to five games behind first-place Boston and are on their first three-game winning streak since four straight from June 18-21.
"I don't necessarily look at it as a desperation," manager Aaron Boone said. "I want us to be a club that has an urgency when we walk through those doors every single day."
Coming off a three-hit shutout of Tampa Bay, Tanaka (9-2) limited the Orioles to a pair of singles and a double. He struck out eight and walked two, lowering his ERA to 2.00 over his last five starts. He is 7-0 in 13 starts since an April 17 loss against Miami and has pitched 17 1/3 consecutive scoreless innings, one out short of his big league best.
He started last season 7-9 with a 5.37 ERA, then finished 6-3 with a 3.59 ERA plus went 2-1 with a 1.80 ERA in four postseason outings.
"He really started to pitch well down the stretch and I think everyone saw how great he was in the postseason," Boone said. "So, hopefully, we're seeing him kind of follow a similar script right now."
Baltimore (32-75) arrived with its first three-game winning streak since mid-May. The Orioles traded infielder Jonathan Schoop to Milwaukee before the game for infielder Jonathan Villar and a pair of prospects, and dealt pitchers Kevin Gausman and Darren O'Day to Atlanta for four prospects and $2.5 million in international signing bonus allotment.
"I see what they're talking about when they're talking about a rebuild and fire sale," said center fielder Adam Jones, who used his contractual right to block a trade. "When players walked out years ago and walked the picket lines and all that stuff, they did all that for reasons like right now. I earned this and it's my decision. I don't have to explain it to nobody."
Having also traded slugging infielder Manny Machado, closer Zach Britton and reliever Brad Brach in recent weeks, the Orioles obtained 14 prospects, Villar and $2.75 million in international allotment for six veterans while cutting nearly $29 million in payroll obligations for this year and next.
"It might not look pretty some days," Jones said. "We're going to struggle the next two months."
A sign of the Orioles' troubles: Davis, in the third season of a $161 million, seven-year contract, went 0 for 4 with a pair of strikeouts and is hitting .157. That would be by far the lowest average for an official qualifier, breaking the mark of .179 shared by Rob Deer (1991) and Dan Uggla (2013).
Run-scoring singles by Torres in the first and Greg Bird in the third built a 2-0 lead, and Bird hit a sacrifice fly in the fifth ahead of Andujar's 13th homer. Yefry Ramirez (1-4) allowed all six runs and lasted five innings.
Jace Peterson hit a two-run double in the eighth off A.J. Cole, and Peterson scored from second when Dellin Betances' pitch went off Higashioka's mitt for a passed ball, and Andujar allowed the catcher's throw to bounce off his glove for an error by the third baseman.
Aroldis Chapman struck out the side for the second straight game and got his 29th save in 30 chances , his 21st in a row.
Tanaka was happy he put behind another slow start.
"Obviously," he said through a translator, "earlier in this season I knew that was not me."
Since Bird's grand slam at Baltimore on July 11, the Yankees are 0 for 14 with four sacrifice flies with the bases loaded.
A crowd of 46,473 was New York's 21st home sellout, the most at new Yankee Stadium, which opened in 2009.
Yankees: LHP J.A. Happ was diagnosed with hand, foot and mouth disease, and it's not clear whether he will be able to start Saturday at Boston. RHP Luis Cessa was removed after allowing one run and two hits in one inning at Scranton/Wilkes-Barre and could get the start against the Red Sox. Newly acquired RHP Lance Lynn, due to report Wednesday, is another possibility. ... OF Clint Frazier is dealing with a migraine issue, not a concussion, according to Yankees GM Brian Cashman.
RHP Sonny Gray (8-7, 5.08) starts Wednesday afternoon's series finale for New York and RHP Alex Cobb (2-14, 6.08) for Baltimore. Gray has won three straight starts for the first time in a year. Cobb leads the major leagues in losses after defeats in five straight outings; he opened with three hitless innings last week against Tampa Bay.