BOSTON -- Jason Hammel thought he'd do a little throwing in the bullpen to stay loose. He wound up being thrown into the tightest spot he could imagine.
After playing more than five hours, the Rays increased their division edge to 2 1/2 games over the Red Sox. Boston's wild-card lead was cut to five games by Minnesota.
"I figured I'd just get some work in," said Hammel, who entered when closer Troy Percival left after his back tightened up. "I hadn't pitched in five days. I wanted to get up and keep the arm fresh. I figured Perc would close it out."
After Pena's homer, Boston loaded the bases with no outs in the 14th against Percival. Hammel took over with a 4-1 lead and retired three straight batters for his first save since he pitched at Class A Hudson Valley in 2002.
"You've got to give Jason Hammel a lot of credit -- my God," Tampa Bay manager Joe Maddon said. "Coming in with the bases loaded at that point of the batting order ... that was a truly tremendous performance."
"The adrenaline was obviously more than I've ever felt," said Hammel, still showing the effect from a celebratory shaving cream pie to the face.
Percival, who said warming up a few times likely led to his back trouble, was excited by Hammel's performance.
"When I'm the weakest link in the bullpen, its a pretty good bullpen," Percival said. "I'll get some treatment tomorrow and it'll be OK. It's nothing."
Tampa Bay was only 1-for-35 with runners in scoring position in this series before Pena homered.
The Rays, who led the division by 5 1/2 games last week, won the final two matchups at Fenway Park. Tampa Bay had its lead sliced to one-half game with its 3-0 loss to Boston on Monday.
"This team is obviously energized because of the way we won it," Pena said. "It's been exciting both days."
The teams meet again next week for three games at Tropicana Field, where the Rays are 6-0 against the Red Sox.
Tampa Bay had managed only one hit with runners in scoring position during this set -- Dioner Navarro delivered a go-ahead double against Jonathan Papelbon in the ninth inning of Tuesday's 5-4 comeback win -- before Pena hit Mike Timlin's pitch into the Green Monster seats.
"We didn't want Pena to hit in that inning because of what he can do," Boston manager Terry Francona said. "He didn't miss with that pitch. That was off the plate."
"I was extremely surprised," Timlin said. "It was a good pitch. We pushed him off the plate and then went down and away."
Trevor Miller (2-0) pitched one hitless inning.
The Red Sox had runners on first and second in the ninth, 10th, 11th and 12th, but did not scored.
Josh Beckett, making his second start after being sidelined for nearly three weeks with an inflamed right elbow, gave up one run and six hits in six innings.
Chad Bradford got Youkilis on a double-play grounder and Bay bounced to short in the 10th. Jacoby Ellsbury, hitless in six at-bats before a 14th inning double, flied out to end the 11th. He also ended the ninth, grounding out.
Rays starter Andy Sonnanstine allowed one unearned run, fanned seven and didn't walk anyone in seven innings.
Boston tied it 1-all on Pedroia's two-out RBI double in the third. Sonnanstine should have been out of the inning, but Iwamura dropped a throw to second on a play that would have been a forceout.
Pedroia's double was his 46th of the season, a club record for second baseman, breaking Jody Reed's mark of 45 set in 1990. ... The Red Sox activated RHP David Aardsma, on the 15-day DL since Aug. 21 with a strained right groin, before the game. ... Francona said RF J.D. Drew, sidelined with a strained lower back since Aug. 18, will see action this weekend. ... Red Sox CF Coco Crisp sat in favor of Ellsbury despite a season-high 11 game hitting streak when he's gone 22-for-43 (.518). "We needed to get Jacoby in there," Francona said. "Coco handled it. I think he wanted to play very badly. If I was Coco I'd want to play very badly, too." ... Maddon said 3B Evan Longoria, out since Aug. 7 with a fractured right wrist, might get into a game over the weekend.
Kansas City Royals fire manager Mike Matheny
The Royals fired manager Mike Matheny and pitching coach Cal Eldred on Wednesday night, shortly after the struggling franchise finished the season with a listless loss to the Guardians.
Can Albert Pujols, Cardinals make a playoff run?
The BBTN crew breaks down how Albert Pujols and the Cardinals got to the playoffs and if they can make a deep run.
Do the Mets have enough firepower to make a playoff run?
Eduardo Perrez and Tim Kurkjian talk about the New York Mets and their chances to advance this postseason.
Which Wild Card teams will move on to the Divisional series?
Tim Kurkjian and Eduardo Perrez preview all of the postseason Wild Card matchups.
Can the Braves win World Series again?
Tim Kurkjian and Eduardo Perrez discuss how the Braves' strong pitching could lead the them to another World Series win.
Mets prep for playoffs with 9-2 rout of Nationals
— After wrapping up a 101-win season with an easy romp, the New York Mets know their next challenge will be much tougher.