Marcio Jose Sanchez, Associated Press
Tampa Bay Rays relief pitcher Troy Percival, right, reaches to tag out Oakland Athletics' Mark Ellis after a bunt attempt in the ninth inning. Percival left the game with an injury after the game.

OAKLAND, Calif. — Tampa Bay ended Oakland reliever Brad Ziegler's record scoreless streak. Then the Rays ended the Athletics' hopes of winning their first series in more than a month.

Ziegler's shutout streak was stopped by B.J. Upton in the ninth inning, and Carlos Pena homered leading off the 12th to give Tampa Bay a 7-6 win over Oakland on Thursday.

Ziegler started his career by not allowing a run in 39 consecutive shutout innings — including the eighth Thursday — to tie a 59-year-old major league record for relievers. Upton hit an RBI double that scored Akinori Iwamura, who walked, to give the Rays a 5-4 lead in the ninth.

"I didn't think about the streak until I started walking back on the mound," Ziegler said. "The first thought that popped in my head was, 'I can't believe that just happened with a runner on first,' but I guess the good thing it wasn't a cheap one. A whole bunch of things fell at once, and so that way there's no pressure from this point on."

Ziegler, Oakland's rookie reliever who began the season in the minors, has been one of the few highlights for Oakland in the second half, setting numerous records including the most shutout innings by any pitcher to start a career. The right-hander extended that mark to tie the major league single-season record for consecutive scoreless innings by a reliever set by Cleveland's Al Benton in 1949.

"It's almost been like a no-hitter type streak or something," A's manager Bob Geren said. "Unbelievable what he's done, but I'll get him right back out and try to start another one. He's been tremendous."

Pena hit his 23rd homer of the season off Santiago Casilla (2-1), and Dioner Navarro added an RBI single as Tampa Bay moved to 26 games over .500 for the first time in franchise history.

"There were many, many moments where momentum shifted, and we were able to stay focused, stay poised and come out of some tough situations," Pena said. "Eventually we were able to put some runs on the board, but the key was being able to stay in the present and not letting that shift of momentum affect our approach at the plate and on the mound. It's a great win for us because it was quite difficult."

Jason Hammel (4-3) pitched 2 2/3 innings to earn the win for Tampa Bay, which lost closer Troy Percival to a sprained right knee in the ninth. Percival hurt himself while fielding a sacrifice by Mark Ellis and had to leave the game after limping back to the mound.

Hammel allowed an unearned run in the 12th before giving way to Trever Miller. Miller the eighth Tampa Bay pitcher, hit Daric Barton before getting pinch-hitter Rob Bowen to hit a grounder to third to earn his first save in two tries this season.

Cliff Floyd walked four times and scored four runs for the Rays, who won two of three from Oakland and haven't lost a series since the All-Star break.

"This type of win is what's been happening since early in the season when we started win a lot of games late," Floyd said. "We've got our confidence up and we believe as long as we go on that field we've got a chance to win."

WHITE SOX 9, ROYALS 2: At Chicago, Jim Thome, Paul Konerko, Alexei Ramirez and Juan Uribe hit consecutive homers in the sixth inning Thursday to tie a major league record, completing a three-game sweep. Thome's two-out, three-run shot, his 25th this season and 532nd of his career, scored Ken Griffey Jr. and Carlos Quentin, who had drawn one-out walks off reliever Joel Peralta.

TIGERS 5, BLUE JAYS 1: At Detroit, Edgar Renteria hit a tiebreaking two-run double in Detroit's five-run eighth inning and the Tigers avoided a four-game sweep. Armando Galarraga (11-4) pitched eight sharp innings for Detroit, allowing a run and six hits.

Red Sox 10, Rangers 0: At Boston, David Ortiz hit a three-run homer to highlight a nine-run second, and the Red Sox used their second big inning in three games against Texas to complete a three-game sweep. Daisuke Matsuzaka (14-2) allowed six hits in seven innings for the Red Sox, who scored 37 runs in the series and won their fourth straight to remain three games behind AL East-leading Tampa Bay.

ORIOLES 11, INDIANS 6: At Cleveland, Lou Montanez hit a tiebreaking double during an eight-run eighth inning, and Baltimore beat Cleveland for a split in their four-game series.

The Orioles sent 13 men to bat in the eighth, getting six hits and three walks in their largest inning of the season. Baltimore has scored 55 runs in its last seven games.

National League

PADRES 3, BREWERS 2: At San Diego, Jake Peavy outpitched Ben Sheets with seven strong innings and San Diego snapped Milwaukee's eight-game winning streak. Peavy (9-8) allowed one run and four hits in a matchup of the past two starters for the NL in the All-Star game. Peavy, the reigning Cy Young Award winner, struck out eight and lowered his ERA to 2.61 to take over the NL lead from San Francisco's Tim Lincecum (2.67).

CUBS 11, BRAVES 7: At Atlanta, A brief benches-clearing skirmish and only the second cycle in Atlanta history couldn't stop the Chicago Cubs from completing their first season sweep of the Braves. Aramis Ramirez and Alfonso Soriano homered to help Chicago to a sweep of the six-game series for the first time since the rivalry between the franchises began in 1876. Mark Kotsay went 5-for-5 and joined Albert Hall as the only Atlanta players to single, double, triple and homer in the same game.

METS 9, NATIONALS 3: At Washington, Brian Schneider homered against his former team again and Carlos Delgado also went deep to help New York finish a three-game sweep. Oliver Perez (9-7) handed a 5-3 lead over to the Mets' beleaguered bullpen in the seventh.

CARDINALS 3, MARLINS 0: At Miami, Ryan Ludwick drove in three runs and Todd Wellemeyer pitched three-hit ball into the eighth inning for St. Louis. Ludwick hit an RBI double in the third and a two-run homer in the seventh.

ASTROS 7, GIANTS 4: At Houston, Lance Berkman hit a tiebreaking two-run homer in the eighth inning to lead the Astros to their eighth straight win. Houston completed a four-game sweep of the Giants and has won 16 of 20 overall.

DIAMONDBACKS 6, ROCKIES 2: At Denver, Chris Snyder and Chris Burke hit consecutive homers in a five-run fifth inning, leading Dan Haren and Arizona to the win. Haren (13-6) pitched eight sharp innings, giving up one run while striking out nine. He also had two hits and scored a run to win for the sixth time in seven starts.

DODGERS 3, PHILLIES 1: At Los Angeles, Hiroki Kuroda allowed only two baserunners in seven brilliant innings, Matt Kemp homered, and the Dodgers completed their first four-game sweep of the Phillies in 46 years.

REDS 3, PIRATES 1: At Pittsburgh, rookie Chris Dickerson had three hits for Cincinnati and broke a sixth-inning tie with a two-out RBI double.

Javier Valentin homered for the Reds, who took two of three from the Pirates and won for the fourth time in 19 games.