ST. PETERSBURG, Fla. — Wade Miley can laugh about it now, but after he was credited with the victory in Boston’s 1-0 victory over Tampa Bay on Tuesday night, his first win in a Red Sox uniform, the left-hander made a startling admission.

“I didn’t know we had scored a run until the seventh or eighth inning," he said. “I’m thinking, ‘Extras.’ Then I’m saying, ‘We got a run! Hell, yeah!’"

Hey, the man was concentrating. It evidently escaped his attention that the Sox had scored the game’s only run back in the third, his batterymate Ryan Hanigan coming around to score when Mookie Betts broke up a double play with a hard slide, and Rays rookie second baseman Ryan Brett threw the relay away.

Miley’s focus was especially sharp through the first five innings, when he threw first-pitch strikes to 15 of 17 Rays hitters. “That’s the goal; that’s the key," he said.

Wade Miley kept the Rays off the scoreboard and earned his first win with the Red Sox. AP Photo/O'Meara

“It puts you ahead, and you can kind of do what you want to do. My last start (seven runs in 2⅓ innings against Washington) was just the opposite. You see the difference. You got a little more confidence, you can nibble a little bit more, because those guys get aggressive, they want to swing when you’re throwing strikes."

But it was in the sixth inning that he really had to lock into the job at hand. A one-out single by Brandon Guyer and a walk to Logan Forsythe, sandwiched around a force play, brought up Evan Longoria and brought back an unpleasant memory for Miley.

“He hit a bomb off me in a very similar situation last year," Miley said.

His memory was a tad faulty — Longoria had taken him deep in Chase Field the previous year, on Aug. 13, 2013, when Miley was pitching for Arizona. But it was a scoreless game at the time and Miley didn’t want a similar result here.

“Forsythe’s the guy I messed up with. I got him 0-and-1, and should have been more aggressive with him,’’ he said. “I didn’t want Longoria to beat me. He’s their guy."

Perhaps pitching too carefully, Miley fell behind Longoria, 3 and 0. All he wanted to do was throw a strike, so he laid in a fastball right down the middle. “I didn’t think he’d swing," Miley said.

Longoria did swing, but fouled the pitch back. He fouled the next two as well. “I didn’t want to walk him, but I wasn’t going to give in to him," Miley said.

The seventh pitch of the at-bat was off the plate, and Longoria didn’t bite. His walk loaded the bases, and manager John Farrell elected to go with right-hander Alexi Ogando to face Desmond Jennings, who rolled to shortstop Brock Holt for an inning-ending force play.

Miley thought he was leaving with a no-decision. He was elated to learn he had a lead, and delighted to have his first win when Koji Uehara closed out the Rays in the ninth, third baseman Pablo Sandoval starting an around-the-horn double play and throwing out Jennings on the game’s final play.

Miley did give the Sox a bit of a scare during the Longoria at-bat when he slipped and fell to his knees. That brought Farrell and a trainer to the mound, the manager saying Miley had turned an ankle.

It was nothing that worrisome, Miley insisted afterward. “It means I’m not athletic at all," he said. “Did you see the first one? It happened twice. Second or third inning, ‘Man down, silhouette out there.’

“The second one was more embarrassing. I told them, ‘Stay out here so I can catch my breath.’"