Hours after the game, the Brewers fired manager Ron Roenicke.
Milwaukee, a big league-worst 7-18 following a 2-13 start, took two of three against the Cubs for its first series win of the year.
Brewers shortstop Jean Segura left after he was hit on the helmet by a pitch from Pedro Strop (0-1) in the eighth inning. Segura initially took first base after he was examined by the training staff for several minutes. He then was replaced by pinch-runner Hector Gomez.
After Ryan Braun grounded into a double play, Ramirez singled for a 5-3 lead.
Will Smith (1-0) got one out for the win, and Francisco Rodriguez pitched the ninth for his fourth save in four chances.