Geovany Soto hit a tiebreaking homer in the eighth inning for the Cubs' first lead of the game and closer Carlos Marmol shut down the Houston Astros in the ninth, giving Chicago a 5-4 victory Wednesday.

Soto's drive off Astros reliever Wilton Lopez was his 17th of the season and it helped the Cubs to their fourth win in five games.

Marmol pitched a perfect ninth for his seventh straight save and career-high 28th of the season. Cubs reliever Andrew Cashner (2-5) pitched one inning and earned the win.

The Astros went up 4-0 in the second inning, but the Cubs got three runs back in the third, including a two-run homer by Marlon Byrd. They tied it 4-all in the fifth when lead off batter Jeff Baker lined a double down the left field line scoring Darwin Barney.

Lopez (5-2) entered in relief in the eighth inning and was the loser.

The Astros batted around in the second, starting with Chris Johnson's leadoff homer. He lined Coleman's 1-1 pitch deep into the left field bleachers for his seventh home run of the season.

Matt Downs then walked, Jason Castro singled and advanced to second and third after an error by Cubs outfielder Alfonso Soriano. Downs scored on a wild pitch.

Back-to-back singles from Jeff Keppinger and Hunter Pence brought home Castro and Michael Bourn, who was hit by a pitch.

The Cubs scored three runs in the third, with the big blow coming on Byrd's two-out, two-run homer. It was Byrd's first home run since Aug. 11 and his 12th overall.

Cub right-hander Casey Coleman went six innings. He gave up four runs on eight hits and five walks. Astros lefty Wandy Rodriguez gave up four runs and eight hits in seven innings. He struck out six and walked one.