BALTIMORE -- The Baltimore Orioles began their game against the Texas Rangers unlike any AL team in major league history, hitting three homers in their first three at-bats.

That might have been good enough to beat most clubs. As it turned out, the Orioles needed two other long balls to mount enough of a cushion to squeeze out a 6-5 victory in a doubleheader opener Thursday.

Ryan Flaherty, J.J. Hardy and Nick Markakis opened the bottom of the first inning with homers off Colby Lewis to give Baltimore a lead it did not relinquish. The previous team to homer in its first three at-bats was the Milwaukee Brewers on Sept. 9, 2007. Hardy was also the middle man in that barrage.

Milwaukee was the third major league team to accomplish the feat, all from the NL.

After the three consecutive home runs, Lewis retired his next 18 batters before Adam Jones homered leading off the seventh to make it 4-1. Lewis walked Matt Wieters, and Wilson Betemit hit a drive to right for a 6-1 lead.

"I've known Colby for a long time. I knew it was only a matter of time before he settled in," Orioles manager Buck Showalter said. "We were fortunate to take advantage of it early. We didn't mount much after that. ... I thought the tack-on runs after the home runs were even bigger."

The five home runs yielded by Lewis (3-2) were a career high. They also were the only hits he allowed over seven innings, and he also set a career high with 12 strikeouts. That made him the first pitcher since 1918 to give up five home runs and have at least 10 strikeouts in the same game.

"I can't justify that game," Lewis said. "It seemed like one of those days where you have really good stuff and then you miss your spot or something and it's just not a hit, it's a homer. You can't really look at it any other way. It was just kind of weird game."

Orioles starter Wei-Yin Chen (3-0) gave up two runs and six hits in 7 2/3 innings, striking out five and walking one. The 26-year-old Taiwan native has allowed two runs or fewer in five of six starts and has a 2.68 ERA in his rookie season.

"Definitely, this is my best outing this year," the left-hander said through a translator.

"Wei-Yin was a difference-maker today, to get that deep in the game, and against obviously a good lineup," Showalter said. "He was outstanding. He was sharp with his breaking ball, the extra days' rest. It seems like he had a little bit more finish on his fastball. He was a difference-maker for us today and it won't be forgotten."

Coming off a four-homer game Tuesday, Texas slugger Josh Hamilton went 1 for 4 with a single and two strikeouts. He came in with five home runs and a double in his previous six at-bats.

The teams were rained out Wednesday night, setting up the doubleheader.

After Chen left in the eighth, Adrian Beltre hit an RBI single to make it 6-2. Pinch-hitter David Murphy added a three-run homer in the ninth off Jim Johnson, who got three outs for his ninth save.

With Chen leading the way, the Orioles snapped a seven-game losing streak against the Rangers. Texas won the first two games of the series 14-3 and 10-3 and outscored Baltimore 70-18 during its seven-game run.

After Texas went down in order in the first, Flaherty hit his first major league homer, driving a 1-0 pitch over the right-field wall to give Baltimore its first lead in the series. Three pitches later, Hardy homered to left, and Markakis followed with his fifth home run on an 0-2 pitch.

It was the first time since June 1999 that Baltimore hit three homers in the first inning.

Lewis then retired Jones on a fly ball, struck out the next six batters and did not allow a runner to reach until Jones homered.

"It was one of the unfortunate things," Rangers manager Ron Washington said of Lewis' performance. "They put three runs on the board and they just happened to be homers. He kept us in the ballgame. After that first inning, you didn't know what to expect. But he settled down and gave us a chance."

After Hamilton flied out to left with two outs and the bases loaded in the fourth, the Rangers closed to 3-1 in the fourth. Michael Young doubled with one out and scored on a two-out single by Yorvit Torrealba.

Game notes

The previous time Baltimore hit five homers in a game was on June 30, 2010, against Oakland. ... Derek Holland was slated to pitch the second game for the Rangers, who were 6-0-5 in doubleheaders since dropping a pair to the Yankees in May 2007. ... Texas SS Elvis Andrus extended his hitting streak to nine games. He has reached base by hit or walk in 27 straight games. ... Baltimore put OF Endy Chavez (oblique) on the 15-day disabled list to make room for second-game starter Tommy Hunter.