Raul Ibanez stroked a ground-rule double in the 12th inning to score the go-ahead run, lifting the New York Yankees to a 5-4 win over the Baltimore Orioles on Tuesday night.

Ibanez, who entered the game as a pinch hitter in the eighth inning, bounced a 1-2 pitch from Pedro Strop (0-1) over the right field wall to score Robinson Cano, who had led off the inning with a first-pitch double.

The Yankees have won two straight after opening this three-game series with a 6-2 victory on Monday to avoid their first 0-4 start since 1973.

Derek Jeter hit a leadoff homer in this one and the Yankees overcame a sloppy start by Freddy Garcia, who threw five wild pitches in 4 2/3 innings.

Former Oriole Clay Rapada (1-0) retired two batters in the 11th to get the win and Mariano Rivera threw a perfect 12th to get his first save after blowing his first opportunity of the season.

J.J. Hardy hit a solo homer in the first inning off Garcia but Baltimore went scoreless over the last seven innings and blew a bases-loaded chance in the ninth when Hardy popped out.

Garcia gave up four runs -- three earned -- in a wild outing that started with a 36-pitch first inning. The 35-year-old righty allowed four hits and three walks and hit the final batter he faced but still avoided a loss.

Meanwhile, Orioles rookie Wei-Yin Chen gave up Jeter's leadoff homer -- the first batter he faced in a regular season MLB game -- but settled down until he was knocked out during New York's three-run sixth inning to tie the game.

The 26-year-old left-hander from Taiwan struck out six and allowed four runs -- two earned -- on seven hits and a walk in 5 2/3 frames.

"He pitched well especially after the way he started. I hope that bodes well for him," said Orioles manager Buck Showalter. "They're a potent lineup, but he handled himself well."

Cano hit a leadoff single to spark New York's three-run rally in the sixth. Mark Teixeira's base hit and Curtis Granderson's walk loaded the bases with one out and Andruw Jones followed with an RBI single. Another run scored when Russell Martin reached on Mark Reynolds' error at third base and Brett Gardner knocked Chen out with an RBI single that tied the game.

Nick Swisher was hit by a pitch leading off the seventh, but was thrown out at home on Cano's double. Cano was stranded after Alex Rodriguez struck out on a Matt Lindstrom pitch that fooled even the catcher Matt Wieters and Teixeira also fanned.

The Orioles left the bases loaded in the ninth inning when Hardy popped out and had just one more runner the rest of the way.

In the 12th, Cano doubled to lead off and went to third on Rodriguez's soft ground out to first base. He wasn't running on Teixeira's chopper to second, letting the Orioles get the second out. No matter. Strop intentionally walked Granderson to get to Ibanez, who jumped on a slider.

Hours earlier, Chen threw five straight fastballs to Jeter and the Yankees shortstop hammered the fifth over the center field wall for a 1-0 lead.

Among Garcia's 36 pitches in the first inning was a 3-2 sinker Hardy knocked over the left field wall for a homer and two wild pitches, including one that scored Nick Markakis for a 2-1 Orioles lead.

Garcia was wild again in the fourth. After Adam Jones led off with a double, the Yankees starter threw a wild pitch that gave him third base, then walked Wieters. Jones scored on Nick Johnson's ground out when Martin dropped the throw home.

Garcia threw yet another wild pitch, but escaped any more trouble when Jeter made a diving stop on the second base side of the infield to get Chris Davis for the final out with a runner at third.

After Robert Andino led off the fifth with a ground-rule double, he went to third on Endy Chavez's sacrifice bunt and scored when Garcia unleashed his fifth wild pitch. Garcia then hit Markakis and was pulled for David Phelps, who kept it at 4-1.

Game Notes

Cano had three of New York's 12 hits...The Orioles finished with six hits, and no player had more than one...The Yankees left 12 men on base and Baltimore eight.