BALTIMORE — The Orioles became the first AL team to open a game with three straight home runs, and Baltimore added two more long balls against Colby Lewis en route to a 6-5 victory over the Texas Rangers in a doubleheader opener Thursday.

Ryan Flaherty, J.J. Hardy and Nick Markakis began the bottom of the first inning with homers to give Baltimore a lead it would 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 assault.

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

Coming off a four-homer game, 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.

After the home run barrage, 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.

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 surrender five home runs and have at least 10 strikeouts in the same 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.

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 top of 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.

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.

NOTES: The game was a makeup of Wednesday night's rainout. ... The prior 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' Elvis Andrus extended his hitting streak to nine games. He has reached base by hit or walk in 27 straight games.