CHICAGO -

Donnie Murphy homered to cap a four-run rally in the seventh inning and the Chicago Cubs connected four times Wednesday to beat the Miami Marlins 9-7.

Murphy's two-run shot put the Cubs ahead 8-7. Starlin Castro, Dioner Navarro and Ryan Sweeney each added solo home runs for Chicago.

The Cubs avoided a sweep and prevented the Marlins from winning four straight for the first time this season.

Adeiny Hechavarria hit a grand slam for Miami and Logan Morrison had a two-run homer.