Updated

A little misfortune wasn't enough to discourage the Tampa Bay Rays.

The Rays held Boston to just three hits in the opening game of a doubleheader and still lost 3-1.

Tampa Bay hit into a triple play in the nightcap, but that only stalled the Rays briefly as they clinched a split with a 6-2 victory on Tuesday night.

"I love the fact that our team loses a very difficult game in the first game but comes back and plays even better in the nightcap," manager Joe Maddon said. "That's who we are. That's what I appreciate about our players. We're never out of it. Nobody believes we're out of this. Everybody believes we're in this thing right now."

The Rays finished the day right where they started it — nine games behind the Red Sox. That's better than losing ground with September coming quickly.

The three-game series wraps up Wednesday afternoon at Fenway Park, where Tampa Bay is certain to have a fresh bullpen. James Shields pitched a complete game in the opener, then Jeff Niemann went the distance in the second game, striking out 10 and holding the Red Sox to just three hits.

The Red Sox couldn't overcome two unearned runs in the second inning of the nightcap. Boston also couldn't capitalize on its first triple play since 1994.

Niemann (8-4) pitched his first complete game of the season and won his seventh straight decision.

"We definitely have the pieces in this clubhouse. We just have to go out there and keep fighting and keep playing," Niemann said. "We have a lot of games left in the division and there's still hope left in here."

Tampa Bay won for the sixth time in eight games and avoided falling any further behind in the American League East.

Rookie Desmond Jennings, who robbed Dustin Pedroia of an extra-base by backing into the left-field scoreboard to make a catch in the first, hit a solo homer off of Erik Bedard (4-8) to put Tampa up 3-1 in the fifth Tuesday night. The ball cleared the famed Green Monster and was out of the ballpark altogether.

Tampa Bay added three in the eighth, including Ben Zobrist's run during a botched rundown that ended up being a double-steal for the Rays. Casey Kotchman followed with a hit that drove in B.J. Upton, who had advanced to second during rundown.

"It's a young group but it's a very professional group that handles adversity well and that's what I really appreciate about our team," Maddon said.

Jason Varitek and Jacoby Ellsbury hit solo homers for Boston. Ellsbury's was his second of the day. He hit a three-run shot that lifted the Red Sox in the opener.

Varitek and Ellsbury were the only Boston players who could solve Niemann, whose 10 strikeouts were one off his career high, set July 29 at Seattle.

"He's got a really good angle. He's a big, tall kid, throws the ball downhill," Boston manager Terry Francona said. "A lot of swings and misses. Maybe there was one walk, so he threw a lot of strikes. He angles that fastball."

Tampa Bay had a great chance to blow the game open earlier with runners at first and second with nobody out, but Sean Rodriguez had the misfortune of hitting into the second triple play in the majors in as many nights.

Upton and Kotchman started the top of the fourth inning with singles off Bedard, who got out of the jam when Sean Rodriguez hit a hard grounder to third. Jed Lowrie fielded it cleanly, stepped on the base and fired it to Pedroia, who got the ball off quickly to Adrian Gonzalez at first and beat Rodriguez to the bag.

"It was hit in the perfect spot," Maddon said. "The imperfect storm for us and perfect for them."

The Milwaukee Brewers also turned one Monday night against the Los Angeles Dodgers.

According to STATS LLC, the last time there were triple plays on consecutive days was May 22-23, 1981. On the 22nd, the Mariners converted a triple play against the Rangers. The next day, the Cleveland Indians converted a triple play against the Yankees.

Bedard had thrown 46 pitches by the time he got out of the second inning. Ben Zobrist led it off with a bunt single, Upton singled to right and Casey Kotchman hit into a fielder's choice that allowed Zobrist to score on a bad throw to home by Lowrie.

The throw got behind Varitek and Kotchman made it to second base. Matt Joyce followed with another fielder's choice that scored Upton.

Notes: The triple play was Boston's first since shortstop John Valentin turned one by himself on July 8, 1994. ... Bedard is winless in three starts with the Red Sox. ... Boston DH David Ortiz was a late scratch from the first-game lineup because of bursitis in his right heel and also sat out the second game. ... Red Sox RHP John Lackey, who is on a six-decision winning streak and is 11-8 despite a 6.13 ERA, faces LHP David Price (10-10, 3.76 ERA) in Wednesday's matinee series finale. ... Lackey is one win behind Jon Lester for the staff lead. Lester was the winning pitcher in Game 1. ... Tuesday's opener was the first game between the teams since the Red Sox beat the Rays 1-0 in 16 innings on July 17 in St. Petersburg. ... The Red Sox, just off a six-game trip to Minnesota and Seattle, are home for just the three games with Tampa Bay. They will then head out on an eight-game trip to Kansas City and Texas.