NEW YORK (AP) Carlos Beltran felt he was finally emerging from a miserable start to his career with the New York Yankees.
One swing Friday night made him certain of it.
The slumping slugger launched a three-run homer with two outs in the ninth inning, giving New York a 5-3 victory over the Baltimore Orioles.
''Thank God the past couple of days I would say I've been feeling more comfortable at the plate and I've been putting good at-bats together,'' Beltran said. ''I just felt confident that I was going to do something positive.''
Beltran signed a $45 million, three-year contract with New York this winter after an All-Star season with the St. Louis Cardinals. But he has struggled with inconsistency and an elbow injury has limited him to the designated hitter role since early June. Beltran began the game batting just .221.
But right after Brian McCann lined an RBI single, Beltran hit a drive off Zach Britton (3-1) far over the left-field wall. It was the first time this year that the Yankees won in their final at-bat at home, and it was their fourth straight victory overall.
''It's been somewhat of a struggle then he got hurt. But you can just see him starting to square the balls up,'' Yankees manager Joe Girardi said. ''That was a tremendous at-bat.''
The Yankees kept coming up empty with runners in scoring position until the ninth. Brett Gardner led off the inning with a single, then Derek Jeter struck out looking and Jacoby Ellsbury flied out.
Mark Teixeira followed with a walk and McCann singled home a run, setting up Beltran's first walkoff homer since 2008, for the New York Mets.
Britton was already off the field by the time Beltran made it to home plate, where he was mobbed by his teammates and then got doused during a postgame interview.
''He just had a couple of sinkers up and they made him pay for it,'' Orioles manager Buck Showlater said of Britton. ''I cannot really fault him, all things considered. He let it rip and it did not work for him tonight.''
David Huff (1-0) gave up Steve Pearce's RBI single in the ninth but got the win.
Leading 3-1 heading into the ninth, the Orioles missed a chance to pull even with the Yankees for second place in the AL East.
''It is frustrating. These are games we want to win right now but you just have to turn the page,'' said Britton, who has two blown saves in 11 chances. ''You cannot just sit here and mope about it. Go out there and make the adjustment.''
Coming off a decisive three-game sweep of the division-leading Toronto Blue Jays, New York jumped out 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.
''We just couldn't seem to get the big hit when we needed it,'' Girardi said.
Center fielder Adam Jones threw a runner out at home plate in the second 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 in the ninth three batters after third baseman Yangervis Solarte made a fielding error to open the inning.
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 bases in the fifth with three straight two-out walks. 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 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. T.J. McFarland was brought in to face Gardner.
Second baseman Ryan Flaherty got the save, though, ranging deep behind second base 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. ... 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, Girardi said. ... Up next: Orioles RHP Bud Norris (6-5) goes against Yankees LHP Vidal Nuno (1-3).