David Robertson pitched a perfect eighth inning Wednesday night, but it didn’t end exactly the way he wanted it to.

After striking out the first two batters he faced, Robertson gave up a ground ball to second to Fernando Martinez and tried to turn quickly off the mound to head toward first base.

But he took a bad step and hurt his left hamstring, causing him to limp off the field.

After getting ice on the injury, the right-hander said he was confident he would be able to pitch when the Yankees return to action Friday night against the A’s in The Bronx following an off day Thursday

“I just kind of felt some discomfort,” Robertson said after the Yankees’ 5-4 win over the Astros. “I felt at first it was my left knee, but I think it was just my hamstring. It’s just a little tight.

“I may have tweaked it a little bit.”

Mariano Rivera came in for the ninth inning and picked up his 11th save.

“I don’t foresee it being a big problem,” said Robertson, admitting it was the first time he has dealt with a hamstring issue.

The back end of the bullpen has been one of the key factors to the Yankees’ early success and that was true again last night, with Rivera, Boone Logan and Robertson combining for 3 1/3 shutout innings in relief of David Phelps.