Raul Ibanez doubled in the tiebreaking run in the 12th inning, and the New York Yankees overcame a three-run deficit and a wild performance by starter Freddy Garcia in a 5-4 victory over the Baltimore Orioles on Tuesday night.

Robinson Cano led off the 12th with a double off Pedro Strop (0-1). With two outs, Ibanez hit a liner off the right-field warning track that bounced into the stands.

Former Oriole Clay Rapada (1-0) got two outs in the 11th, and Mariano Rivera worked a perfect 12th for his first save this year and the 604th of his career.

Both teams had trouble delivering in the clutch on a chilly night at Camden Yards. New York went 2 for 18 with runners in scoring position and the Orioles 0 for 8.

Garcia and Orioles left-hander Wei-Yin Chen both had memorable performances. Garcia threw five wild pitches, one short of the major league record, and Chen took a 4-1 lead into the sixth inning in his major league debut.

In the sixth, the Yankees used three hits, a walk and a costly error by third baseman Mark Reynolds to pull even and chase the 26-year-old Taiwan native.

Chen gave up a home run to his first batter, Derek Jeter, whose 25th leadoff homer broke a tie with Rickey Henderson for most in franchise history. The former Japanese Central League standout then threw four straight scoreless innings before apparently tiring.

Chen allowed four runs, two earned, and seven hits in 5 2-3 innings. He struck out six, walked one and was lifted after 101 pitches.

Garcia yielded four runs, three earned, four hits and three walks in 4 2-3 innings. He's the first player to throw five wild pitches in a game since Philadelphia's Ken Howell in 1989.

Chen began his long-awaited debut by missing the strike zone on three straight pitches. Jeter then took a strike before driving a fastball well over the center-field wall. Nick Swisher followed with a double, but Chen worked out of trouble despite hitting Alex Rodriguez with a pitch.

Garcia was even shakier in the bottom half. After J.J. Hardy hit a solo homer, Nick Markakis walked and Matt Wieters singled with two outs. Garcia then threw a pair of wild pitches that enabled Markakis to score the go-ahead run.

The next flurry of activity came in the Baltimore fourth. Adam Jones led off with a double, took third on a wild pitch and scored when catcher Russell Martin dropped a throw to the plate.

Chen retired 12 straight batters before Martin's one-out single in the fifth. Brett Gardner also singled, and both runners moved up on a groundout by Jeter before Swisher flied out.

Baltimore made it 4-1 in the bottom half when Robert Andino doubled, advanced on a sacrifice and scored on a wild pitch.

In the sixth, Reynolds let in a run when he mishandled a sharp two-out grounder by Martin, and Gardner hit an RBI single to end Chen's outing.

NOTES: The Yankees will send LHP CC Sabathia to the mound in the series finale Wednesday night. Sabathia is16-2 against Baltimore. Jake Arrieta will pitch for the Orioles, seeking to build upon a season-opening performance in which he threw 7 shutout innings against Minnesota. ... Baltimore has homered in the first or second inning of every game. ... Nine of Hardy's 32 homers with Baltimore have come in the first inning.