CC Sabathia cruised early Thursday night, but a blast from an old nemesis and a rough fifth inning ended his night early.

The lefthander was charged with four runs in 4 1⁄3 innings and was not involved in the decision as the Yankees beat the Rays, 6-5, in 11 innings.

Tampa Bay got on the board in the fourth when Evan Longoria hit his eighth career home run against Sabathia, and the Rays scored three more in the fifth.

Sabathia was taken out with a 3-2 lead, one out and two runners on base. He was visibly upset and appeared to utter an expletive when Joe Girardi came to the mound to remove him.

“It was tough,” Girardi said of his decision to pull Sabathia, who entered the game with a 7-1 record and a 1.62 ERA in his previous nine starts. “What I saw was the at-bat that [Tim] Beckham put on him took something out of him. I thought his arm got a little bit lower. He threw a lot of pitches there and I just thought I would go with a fresh arm.”

Beckham struck out after an 11-pitch at-bat, but Adeiny Hechavarria and Peter Bourjos followed with doubles. Steven Souza Jr. then drew a walk. Sabathia, who threw 86 pitches, was replaced by Chad Green, who allowed a two-run double by pinch hitter Brad Miller.

Sabathia said he did not notice the arm drop that Girardi mentioned. “He’s the manager and that’s what he gets paid to do,’’ he said. “ . . . I’m always upset to come out of a game, but it worked out for us. We got the win and that’s all that matters.”

advertisement | advertise on newsday

Sabathia retired 13 of the first 16 batters he faced. The only blemishes were singles by Longoria and Beckham and the home run by Longoria, who is 32-for-76 (.421) against Sabathia.

Longoria was in the on-deck circle when Sabathia was pulled, but Sabathia said he was not concerned about the three-time All-Star. “I wasn’t thinking that far ahead,’’ he said. “I knew I had [Trevor] Plouffe coming up with a chance to get a double play.”

“I wasn’t going to let him face Longoria again, so I decided to make the change,” Girardi said. “It wasn’t easy.”

Yankees videos