ST. PETERSBURG, Fla. – Josh Beckett was a dribbler from being perfect.

Beckett pitched the first one-hitter of his career Wednesday night, limiting the Tampa Bay Rays to Reid Brignac’s third-inning infield single in a 3-0 victory for the Boston Red Sox.

“I felt good. They were hitting balls at guys, and that’s nice,” Beckett said after his fifth career shutout and first complete game since 2009. “When you miss your spot and they still hit it at somebody, it’s just one of those nights.”

Kevin Youkilis hit a three-run homer and Beckett retired the last 19 batters he faced in outdueling rookie Jeremy Hellickson, who matched Beckett out for out into the seventh inning.

Beckett struck out six and walked none, throwing 97 pitches to post his first shutout since beating Kansas City 6-0 at Fenway Park on July 12, 2009. It was his 10th complete game, and first since a 9-1, five-inning victory against the Rays at home on Sept. 12, 2009.

“That’s about as good as you can pitch,” Boston Manager Terry Francona said, noting Brignac’s hit came on a low change-up that probably would have bounced if he had swung and missed.

“If it wasn’t for that little 3-iron out of the rough — that ball was about off the dirt. (Beckett) was tremendous. It was fun to watch.”

Beckett said as the game progressed, he never thought about what might have been if Brignac had not reached base.

“No, because it was a hit,” Beckett said. “It doesn’t matter who’s playing over there. It doesn’t matter how you draw it up. It’s a hit. It wasn’t a perfect game. It was a one-hitter.”

Youkilis homered off Hellickson (7-5) in the seventh, ending Hellickson’s streak of innings without allowing a run at home to 24. The Red Sox were held to one hit before Dustin Pedroia tripled and Adrian Gonzalez drew an intentional walk to set the stage for Youkilis’ towering drive over the left-field wall.

The loss dropped the third-place Rays 41/2 games behind the Red Sox in the AL East. It was Boston’s first win in four games against Tampa Bay this season.

The teams conclude a three-game series tonight, with right-hander Clay Buchholz facing lefty David Price in what could be another terrific pitching matchup.

“That why I think this (race) is going to go back and forth,” Rays Manager Joe Maddon said. “I don’t see one team running away and hiding at any point.”

The Red Sox outscored opponents 83-36 during the longest winning streak in the majors this season, but they generated few opportunities the past two nights against the Rays.

Gonzalez had three of the team’s five hits off James Shields in the series opener, all singles. Pedroia singled in the first for the first hit off Hellickson and Jacoby Ellsbury drew a fourth-inning walk. Both runners were erased on double plays.

Beckett was just as impressive.

He retired eight straight before Brignac hit his slow roller up the third-base line and easily beat the throw to first with two outs in the third. Beckett’s errant pickoff throw allowed Brignac to move into scoring position, but Johnny Damon struck out to end the inning.

“It was unbelievable. I don’t know how he hit that ball,” said Youkilis, Boston’s third baseman. “There was really no play on it.”

Damon finished 0 for 4, ending his franchise-record on-base (by hit, walk or hit by pitch) streak at 39 games, the longest stretch in the majors since Logan Morrison’s streak of 42 games for Florida last season.