Wei-Yin Chen had a rocky start and a lamentable finish in his major league debut. In between, the Taiwan native performed pretty darn well.

And for that reason, the Baltimore Orioles are optimistic Chen will be even better when he doesn't have to deal with a tough New York Yankees lineup and a strong case of nervousness.

Chen pitched into the sixth inning before tiring, and long after that the Yankees scored a 12th-inning run to earn a 5-4 victory Tuesday night.

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, retiring 12 straight at one point.

Baltimore led 4-1 in the sixth before the Yankees used three hits, a walk and a costly error by third baseman Mark Reynolds to pull even. With two outs, Orioles manager Buck Showalter worked his way to the mound and took the baseball from the 26-year-old left-hander.

"When Buck walked to me I was pretty upset about myself because I didn't have command tonight," Chen said through an interpreter. "I didn't help the team get a win tonight. This is the reason I'm here, to help the team get a win. I'm not satisfied."

"Physically, I'm not tired at all," Chen said. "Mentally, I got tired."

Chen allowed four runs, two earned, and seven hits. He struck out six, walked one and was lifted after 101 pitches.

"To be honest with you guys, this is my first major league outing. I was so nervous," Chen said. "But after the first inning everything was fine for me."

Showalter said: "If he pitches like he did tonight, he'll have a lot of success."

Raul Ibanez finally decided the battle of missed opportunities in the 12th inning, delivering a two-out double to score the go-ahead run.

Robinson Cano led off the 12th with a double off Pedro Strop (0-1). Four batters later, 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.

"It just seemed to be one of those games for both teams. We had our opportunities to score runs," Yankees manager Joe Girardi said. "It was a strange day. Just a strange day."

Yankees starter Freddy Garcia threw five wild pitches, one short of the major league record. He 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: New York clinched another series win over Baltimore. The Orioles are 0-6-2 since their last series win over New York, in September 2010. ... The Yankees will send LHP CC Sabathia to the mound in the series finale Wednesday night. Sabathia is 16-2 against Baltimore. Jake Arrieta will pitch for the Orioles, seeking to build upon a season-opening performance in which he threw seven 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.