Ramirez took a few steps to his left and bent down at the waist to field Yangervis Solarte's bouncer with nobody out in the fourth and a runner at first. Ramirez threw to second for the force, then walked slowly around the infield.
A trainer came out to check on Milwaukee's cleanup hitter, who appeared to be grabbing the back of his left leg, and Ramirez left the game.
''I pulled my hamstring right when I stretched for the ball,'' Ramirez said. He will be evaluated on Sunday.
''Sixteen years in the big leagues and I've never had a hamstring injury before, so I don't know what to expect,'' Ramirez said.
Ramirez hit a solo shot the previous inning for his fifth homer of the season. He had been mired in a prolonged slump.
The Brewers are already without outfielder Ryan Braun, on the disabled list with a strained right oblique. The slugger might be ready to return Tuesday for the start of a three-game series against Pittsburgh.