Updated

Evan Longoria and B.J. Upton provided the power early and the Tampa Bay Rays snapped their four-game losing skid.

Longoria hit a pair of homers and drove in three, Upton smacked a three-run shot and Elliot Johnson added a solo blast in an 8-4 win over the Texas Rangers in the finale of a three-game set Wednesday.

"We knew we had to jump out to a quick lead and we did that," Upton said. "We kind of kept our foot down and didn't stop."

Alex Cobb, who's tied for the American League lead with four wins in August, didn't make it out of the fifth inning. He surrendered four runs -- three earned -- on eight hits and a walk over 4 2/3 frames for Tampa Bay.

Jake McGee (5-2) tossed a 1-2-3 sixth to pick up the win.

Josh Hamilton hit his 36th homer and Matt Harrison (15-8) was touched for seven runs on 12 hits and a walk over 5 1/3 frames for Texas, which had won six of its last seven coming in.

"Executing early in the game, I wasn't able to do that," Harrison said. "The home runs killed me tonight."

The Rays jumped out to a 6-0 lead after plating three runs in each of the first two innings.

Desmond Jennings led off the game with a single and came home two batters later when Ben Zobrist doubled down the left field line. Longoria then hit a two-run homer to center field.

In the second, Sam Fuld lined a one-out triple to right and Jennings walked before Upton belted a three-run blast deep into the seats in left field for a 6-0 lead.

The Rangers got two runs back in the home half and a run apiece in the third and fifth frames.

David Murphy had a one-out single in the second and Mitch Moreland cracked a two-run homer over the left-center field wall.

Nelson Cruz grounded into an RBI fielder's choice in the third and Hamilton launched a one-out solo homer in the fifth into the second deck in right field to make it 6-4.

Johnson got a run back for the Rays in the sixth with a leadoff homer to left field and Longoria added some insurance in the ninth with a blast to center field.

Game Notes

Harrison is 1-2 with 5.55 ERA in his career against the Rays ... Upton's homer was his 16th of the year ... Tampa Bay was 3-for-7 with runners in scoring position, while Texas finished 1-for-7.