BALTIMORE -- Down by four runs and going up against unbeaten Cole Hamels, the Baltimore Orioles used the long ball and a relentless offense to pull out a victory.
Why, it was just like old times.
Jonathan Schoop and Adam Jones both homered and drove in three runs, and the Orioles rallied to beat Hamels and the Texas Rangers 9-7 on Thursday night for a four-game sweep.
Mark Trumbo and Chris Davis also went deep for the Orioles, who trailed 5-1 in the fifth inning before coming back to hand Hamels (4-1) his first loss in 10 starts this season.
Baltimore had 10 hits -- three homers, a double and six singles -- from the fifth through the eighth innings.
"That's some things we've done in the past that put us in a good position in April and part of May," manager Buck Showalter said. "Hopefully it's a sign of getting back to doing some of those things."
The Orioles' four-game winning streak is their longest since a six-game run in early May, and it puts them within three games of .500 (46-49) for the first time since July 4.
"When you win, it's different," Schoop said. "You have fun."
Baltimore hit 10 home runs in the series and outscored Texas 34-11.
Miguel Castro (2-1) worked the sixth for Baltimore after starter Wade Mileyallowed five runs over five innings.
Mike Napoli homered for the Rangers, whose five-game skid matches their season high.
"This is a team that prior to the break was swinging the bats well, throwing it well, pitching well," manager Jeff Banister said. "To say that just is going to completely vanish for an extended period of time, I don't believe in that. I still believe in this core group of players and how they play."
Adrian Beltre had two hits for Texas and has 2,985 for his career, tied with Sam Rice for 31st place on the all-time list.
Hamels brought a 21-inning scoreless streak into the game and extended it to 24 -- third-longest of his career -- before Schoop homered in the fourth.
Jones and Trumbo connected in the fifth, and Hamels was lifted after Baltimore used three straight singles to pull even in the sixth. Jones greeted Jeremy Jeffress with an RBI double, and Schoop capped the uprising with a two-run single for an 8-5 lead.
Davis homered in the seventh, and the Rangers scored two in the ninth off Zach Britton.
Hamels gave up seven runs, along with a season-high nine hits and three home runs.
"The way that I pitched myself into situations and not finishing off hitters in counts that are favorable to me, that's unacceptable on my part," the left-hander said.
Texas LHP Jake Diekman threw his first bullpen session since undergoing surgery to remove his colon in January. Diekman, who has pitched in 283 games over five years, was diagnosed with ulcerative colitis as a child. A flare-up of the condition led to offseason surgery.
"Pretty crisp early on," Banister said. "Fatigued in the middle of it. That's to be expected. I saw a lot of joy in a guy that hasn't been on a mound in a long time."
The Orioles skipped batting practice, not because they scored 22 runs in the previous two games but because the heat index was around 102 degrees.
"It didn't make a whole lot of sense," manager Buck Showalter said.
Rangers: RHP Keone Kela (4-1, 2.64 ERA in 30 games) was activated from the DL. He had been sidelined since June 27 with a sore right shoulder. To make room on the roster, Texas designated INF Pete Kozma for assignment. Kozma hit .111 with two RBI over 28 games.
Orioles: Rule 5 OF Anthony Santander (right forearm strain) is expected to begin a rehabilitation assignment next Thursday. He hasn't played this season.
Rangers: RHP Yu Darvish (6-8, 3.45 ERA) starts Friday in the opener of a three-game series at Tampa Bay. He's 4-0 with a 1.09 ERA and 40 strikeouts in five career starts against the Rays.
Orioles: The Houston Astros, who own the best record in the AL, come to town for a three-game series. RHP Ubaldo Jimenez (4-5, 7.01 ERA) starts the opener Friday night.