ST. PETERSBURG, Fla. (AP) -- Tampa Bay was in a jam in the 10th inning when manager Joe Maddon decided to bring in veteran Roberto Hernandez.
It turned into a disaster for the slumping Rays.
Hernandez walked Mike Napoli on four pitches and Mike Carp followed with a pinch-hit grand slam, sending the Rays to a 7-3 loss to the Boston Red Sox.
Dustin Pedroia opened the 10th with a walk against Joel Peralta (2-7) and went to second on Shane Victorino's bunt. After Ortiz was intentionally walked, Maddon went to Hernandez.
"I just thought two things," Maddon said, "that Roberto would throw a strike, and he had a better chance to put the ball on the ground, regardless of who the hitter was."
Hernandez accomplished neither objective. After Napoli walked, Carp drove the next pitch over the wall in center for Boston's first pinch-hit grand slam since Kevin Millar hit one at Milwaukee on June 7, 2003.
"I'm not going to complain about the decisions they make," Peralta said. "Napoli's a tough hitter and this wasn't my best day so I'm OK with it."
Hernandez, a starter in 24 of his 27 appearances with the Rays this season, declined to comment.
Boston closer Koji Uehara (4-0) struck out two during a perfect ninth. He has retired his last 34 batters.
The victory pushed Boston to a season-high 9½-game advantage over second-place Tampa Bay in the division race.
James Loney homered for the Rays, who have has lost 13 of 17. Tampa Bay's lead for the second AL wild-card spot was trimmed to one game over the New York Yankees, who won 5-4 at Baltimore.
The Rays trailed 3-1 before Evan Longoria doubled in a run in the seventh and Loney hit a tying solo shot off Brandon Workman in the eighth.
"You can slice and dice it, but we had chances to score way more than three runs tonight and didn't do that," Maddon said. "That and a couple walks in the ninth inning were really our downfall tonight."
Napoli had a two-run double and Daniel Nava hit an RBI grounder off Alex Cobb to put the Red Sox up 3-0 in the third.
The Rays got one back in the bottom half on David DeJesus' RBI double. Red Sox shortstop Stephen Drew made a strong defensive play later in the inning with two outs and the bases loaded when he drove to his right to field Desmond Jennings' grounder and then throw out Matt Joyce at second base.
Ryan Dempster, who gave up one run, four hits and five walks in five innings, struck out Jennings to leave the bases loaded in the fifth.
Cobb allowed three runs and seven hits over 5 2-3 innings.
Tampa Bay just missed turning a triple play in the sixth. With runners on first and second, Longoria leaped to grab Will Middlebrooks' high-hopper near the line and then landed on the third-base bag. Longoria threw out Drew at second, but Middlebrooks just beat the ensuing throw to first.
NOTES: Since Aug. 24, when the Red Sox and Rays were in a virtual tie for first place, the Red Sox have scored 7.1 runs per game while going 13-3. The Rays have scored 2.6 runs per game while going 4-13. ... Red Sox manager John Farrell said RHP Clay Buchholz came through his first start in three months Tuesday night in good shape and will pitch again on Sunday. Buchholz, who had been sidelined by a strained neck, threw five innings in Boston's 2-0 win over the Rays. ... Tampa Bay is hitless in its last 12 at-bats with the bases loaded. ... Texas Rangers senior adviser Tom Giordano scouted the game on the 60th anniversary of his debut as a major league player with the Philadelphia Athletics, a game in which he hit a home run.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.