David Freese put St. Louis in front with a grand slam during a five-run first inning Friday and the Cardinals then fought off Milwaukee for a 7-6 victory.

St. Louis had a 6-0 lead through three innings, but it took 3 2/3 innings of scoreless work by the Cardinals’ bull pen to ensure the win.

The Brewers battled back on the heroics of Aramis Ramirez, who hit a three-run homer in both the fourth and sixth innings. Ramirez had six RBI for the season coming into the game and doubled that total.

Milwaukee’s comeback attempt fizzled when the Brewers could put just two runners on base over the final three frames. One of those was thrown out attempting to steal second.

Matt Holliday singled in what turned out to be the winning run in the fourth, giving St. Louis a 7-3 lead.

Jamie Garcia (5-2) earned the win although he allowed all six runs on six hits in 5 1/3. Edward Mujica struck out one in a perfect ninth for his 12th save.

Freese hit his grand slam off Wily Peralta (3-4), who eventually surrendered seven runs on 11 hits in five frames.

Milwaukee lost its fourth in a row.