The Dodgers received a masterful pitching performance from the rookie left-hander Hyun-Jin Ryu, who allowed three hits and a walk in seven scoreless innings, as well as a reawakening from Yasiel Puig. They also watched as the Cardinals made the kind of costly mistakes that they had not made in St. Louis.

But the lift that the Dodgers needed most may have simply been the presence of Ramirez, the engine of their offense and the anchor of their hopes. He delivered two base hits — both looped into center field, one of which delivered a run — and a deep fly ball to right, which would help the Dodgers take the lead. He also affected the way the Cardinals pitched to the rest of the lineup.

“You’ve got the whole off-season to worry,” said reliever Brian Wilson, a two-time champion with the Giants, who pitched a scoreless eighth ahead of closer Kenley Jansen. “If you can just strap it on, I can promise you that it’s all worth it when in November when you sit back and you’re a winner.”

Ramirez was drilled by a pitch from Joe Kelly in the opener and was scratched from Game 2. A CT scan Sunday revealed that Ramirez had a fractured rib on his left side. Once doctors assured the Dodgers that Ramirez could do no further damage unless he was hit in the rib again, he received an injection to numb the pain and proceeded to play.

One by one, circumstances were stacking up against the Dodgers.

They had used their two best pitchers, Clayton Kershaw and Zack Greinke, in the first two games of the series and won neither. Ramirez was intentionally walked twice in the opener and then missed the next day, so with or without their best hitter, who batted .500 with six extra-base hits and six runs batted in a division series against Atlanta, they would have to beat the Cardinals’ ace, Adam Wainwright, to keep from falling into an almost insurmountable hole.