BALTIMORE — Rallying from a late deficit was impressive enough. That the Baltimore Orioles pulled it off against two of the Yankees' best pitchers made the comeback even sweeter.

Chris Davis homered, Hyun Soo Kim and Mark Trumbo had three hits apiece and the Orioles squeezed out a 6-5 victory Friday night.

After the Yankees used three home runs to build a 5-2 lead, Baltimore turned it around against Nathan Eovaldi and the New York bullpen, most notably Dellin Betances.

The Orioles scored three runs off Eovaldi to pull even, then used two singles and a run-scoring groundout by Manny Machado to go ahead in the seventh against Betances (2-3).

Bidding to win his seventh straight decision, Eovaldi lost control of the game in the sixth.

"We were up by three runs in that situation and I just have to do a better job of getting quick outs and attacking the hitters," Eovaldi said. "It was frustrating because I let them back in the game."

Kim scored a run in the sixth, set up the tiebreaking tally in the seventh and upped his batting average to .391.

"He's been right in the middle of just about everything for us, it seems," manager Buck Showalter said.

Mychal Givens (5-0) pitched 1 1/3 innings of relief and Zach Britton worked the ninth for his 16th save.

Carlos Beltran, Alex Rodriguez and Austin Romine homered for the Yankees, who have lost seven of 10.

New York first baseman Mark Teixeira left the game in the third inning with right knee discomfort. He was examined by an Orioles team physician and left the stadium to get an MRI.

"We have not heard anything from a doctor," manager Joe Girardi said. "It's something he's dealt with before. For whatever reason, it started locking up tonight. We'll get it checked out and we'll know soon."

In the sixth, two hits and a walk loaded the bases for Matt Wieters, who singled in two runs. Kirby Yates then yielded a game-tying RBI double to Jonathan Schoop.

Adam Jones led off the seventh with a single off Betances on an 0-2 pitch. A single by Kim put runners at the corners before Machado hit a dribbler up the third-base line that provided Chase Headley no option but to throw to first.

"I definitely thought we had it today," Betances said. "Evo was doing an awesome job. He got into trouble that inning. But we still had a chance there. I like my chances when I'm in there. It just didn't go my way."

Orioles starter Chris Tillman gave up five runs and eight hits in 5 2/3 innings, but his six-game winning streak remained intact.

Tillman allowed an infield hit and faced the minimum through three innings before labouring in the fourth.

Brett Gardner walked before Beltran and Rodriguez homered in succession, both on 3-1 pitches.

After Davis connected in the bottom half to cut the deficit to 3-2, Romine led off the fifth with a drive into the seats in left field.

ENEMY TERRITORY

Former Steelers coach Bill Cowher was in attendance because his wife, known professionally as Queen V, sang the national anthem. Cowher sat in the front row behind the screen, wearing an Orioles hat. Yet when he was shown on the big screen scoreboard, many of the fans booed.

SLUMP BUSTERS

Yankees: Gardner snapped an 0-for-24 skid with a first-inning single. ... Before his home run, Rodriguez was 3 for 25 since coming off the DL on May 26. ... Teixeira is in a 1-for-18 slump.

Orioles: Davis was 0 for 15 before connecting.

TRAINER'S ROOM

Yankees: INF Dustin Ackley (shoulder) had season-ending surgery Friday. Girardi expects Ackley to return for spring training next year. ... C Brian McCann (hyper-extended elbow) was held out of the lineup for a second straight day though Girardi said he would have been available if needed.

Orioles: Setup man Darren O'Day was placed on the 15-day DL with a right hamstring strain. ... RHP Yovani Gallardo (shoulder) felt no lingering pain after his first rehabilitation start Thursday. He will next throw 75-85 pitches on Tuesday, likely for Triple-A Norfolk.

UP NEXT

Yankees: Ivan Nova (3-3, 3.98 ERA) looks to snap a two-game losing streak on Saturday. Two of his three career complete games have come against the Orioles.

Orioles: Tyler Wilson (2-4, 3.83) tries to get back on track after going 0-3 with a 5.30 ERA in his last three starts.