NEW YORK — Zach Britton was in a hurry to put this loss behind him.

The Orioles closer was off the field before Carlos Beltran rounded the bases on his three-run homer with two outs in the ninth inning Friday night, giving the New York Yankees a 5-3 victory over Baltimore.

"It is frustrating, these are games we want to win right now but you just have to turn the page," Britton said after blowing his second save in 11 chances. "You cannot just sit here and mope about it, go out there and make the adjustment next time."

Britton (3-1) started the ninth inning with a two-run lead and having allowed only one hit and a walk over his past five outings. He was off the mark from the start in this one, though. He gave up a single to Brett Gardner before getting two outs.

He then walked Mark Teixeira and allowed an RBI single to Brian McCann. Beltran worked the count to 3-1 before he launched a high two-seam fastball over the wall in left field.

"He just had a couple of sinkers up and they made him pay for it," Orioles manager Buck Showalter said of Britton. "I cannot really fault him, all things considered. He let it rip and it did not work for him tonight."

Center fielder Adam Jones threw a runner out at home plate in the second inning and hit an RBI single in the sixth, helping the Orioles take a 2-1 lead.

Nick Hundley doubled for the Orioles' first hit off Hiroki Kuroda leading off the sixth and scored on Pearce's one-out double.

Pearce had an RBI single off David Huff (1-0) in the ninth three batters after third baseman Yangervis Solarte made a fielding error to open the inning, giving the Orioles a chance to move into a tie with the Yankees for second place in the AL East.

Coming off a decisive three-game sweep of the division-leading Toronto Blue Jays, New York jumped to a quick lead on Teixeira's RBI double. Then they fizzled, wasting three chances with the bases loaded and failing to capitalize on a career high-tying six walks from Ubaldo Jimenez.

"The walks were still a problem. I thought he was fortunate tonight," Showalter said. "Maybe he was more fortunate than anything and he grinded his way through it and did not implode."

The Yankees loaded the bases for the first of three times in the second but Beltran, who doubled leading off, tried scoring on Gardner's fly to medium center field. Jones' throw reached Hundley on one perfect hop, and the catcher had plenty of time to apply the tag for the double play.

Jimenez loaded the bases in the fifth with three straight two-out walks. The right-hander has been stung regularly this season in the fifth, giving up 12 of his 41 runs for a 9.26 ERA in that inning. This time he needed one pitch to get out of the jam: Teixeira grounded to first base on the first pitch he saw, keeping it 1-0.

"The first four innings I felt really good, then in the fifth inning I started rushing my mechanics," Jimenez said.

The Yankees loaded the bases again with two outs in the sixth — a single and two walks — but this time Jimenez wasn't given a chance to quash the rally. Showalter hurried out of the dugout following a walk to Solarte and called on T.J. McFarland to face Gardner.

Second baseman Ryan Flaherty got the save, though, ranging deep behind the bag to field Gardner's hard one-hopper and making a swift, backhand flip to shortstop J.J.Hardy covering for the forceout.

NOTES: Yankees 2B Brian Roberts singled in the second for his 1,500th career hit. He had 1,452 with the Orioles before signing with New York this offseason. ... Showalter said C Matt Wieters (Tommy John surgery) should visit the team in early July. ... Yankees RHP Michael Pineda (60-day, right shoulder muscle) could begin throwing soon. Pineda says he feels good but he had an MRI to make sure the muscle is fully healed before he starts a program, manager Joe Girardi said. ... Up next: Orioles RHP Bud Norris (6-5) goes against Yankees LHP Vidal Nuno (1-3).