Star outfielder Adam Jones started for the Orioles, a day after he ran into a wall and was forced to leave, but Baltimore lost for the eighth time in nine games.
Jones went 1 for 4 with two strikeouts, one coming with the bases loaded in the third inning.
Hamels (2-1) gave up one run and two hits. Acquired from Philadelphia shortly before the July 31 non-waiver trade deadline, the three-time All-Star won for the first time at home after a pair of no-decisions.
The left-hander had pitched a no-hitter in his final start for the Phillies.
Shawn Tolleson pitched a scoreless ninth inning for his 27th save in 29 chances.
Shin-Soo Choo and Chris Gimenez hit solo home runs for Texas.
Kevin Gausman (2-6) allowed four runs and nine hits in 6 2-3 innings. He has made 11 starts this season, beginning in late June, with one win.
Hamels gave up a second-inning single to Matt Wieters and a third-inning double to Paul Janish, the latter followed by three walks that scored Baltimore's run.
Following the bases-loaded walk to Chris Davis, Hamels retired the next 14 batters.
In five starts for Texas since the trade, Hamels has a 3.89 ERA. He had a 3.64 ERA in 20 starts for the Phillies.
Gimenez's home run in the fifth inning was his career-high fourth of the season, all coming in his last 11 games since his recall from Triple-A Round Rock. He hit six homers in 185 games over parts of six seasons before this year.
Choo homered in the fourth inning and drove in a run in the fifth on an infield out. He has reached base safely in all 32 starts he's made since the All-Star break.
Orioles outfielder Dariel Alvarez made his major league debut after being called up from Triple-A Norfolk earlier in the day. The Cuban went 0 for 3.
In the second inning, Alvarez ran down a sinking liner hit by Elvis Andrus and threw home to nab Adrian Beltre to complete a double play.
Orioles: SS J.J. Hardy (groin) rejoined the team while on the disabled list through Sept. 8. He'll go through light workouts before swinging a bat or running.
Rangers: OF Josh Hamilton (sore left knee) took batting practice. He's eligible to come off the disabled list on Monday, the day before rosters are expanded.
Orioles: RHP Ubaldo Jimenez (9-8) has lasted six innings in one of five August starts.
Rangers: LHP Martin Perez (1-3) will pitch on eight days' rest. In his seven starts since being activated in mid-July following Tommy John surgery, Perez hasn't allowed a home run in 37 1-3 innings.