The 33-year-old Johnson has a history of back problems, having missed three months in 2007 with a herniated disk and spent stints on the disabled list in '08 and '09 with back spasms.
Ramirez was disabled with a strained right hamstring suffered running the bases in San Francisco.
He returned to the cleanup spot and went 0-for-3 with three flyouts and made an error in left field in the fourth inning, allowing Cardinals catcher Yadier Molina to advance to second base on a single. Molina then scored on Aaron Miles' single.
Johnson missed the last three games before the All-Star break and will be eligible to return July 24.
Manager Joe Torre said Johnson's back had improved.
"We're already six or seven days into this thing and he'll be eligible a week from Saturday and by then should be OK," Torre said. "It's getting better, but he still has a few spots where he feels it."
Johnson has been the most frequently used defensive replacement for Ramirez. Torre said he will use both Xavier Paul and Garret Anderson instead.
As for Ramirez, Torre said he was unconcerned with the outfielder's stats during a Minor League rehab assignment at Class A Inland Empire -- 0-for-9 with five strikeouts.
"He hasn't done a lot, but nothing bothered him," Torre said.