Updated

Welington Castillo plated the go-ahead run with a two-out double in the top of the 10th inning, and the Chicago Cubs avoided a three-game sweep with a 5-4 come-from-behind win over the Cincinnati Reds at Great American Ball Park.

The Cubs overcame a four-run deficit with some clutch two-out hitting to snap a season-worst six-game losing streak.

Scott Hairston drew a two-out walk to extend the 10th for Castillo, who grounded a J.J. Hoover (0-4) pitch past third baseman Todd Frazier and into the left-field corner.

"A four-run deficit against that team, to come back -- we got some big hits," Chicago manager Dale Sveum said.

Kevin Gregg (1-0) recorded the final out with two runners aboard in the ninth and worked out of a jam in the bottom of the 10th. He issued a one-out walk to Frazier before pinch-hitter Jack Hannahan reached on catcher's interference.

The Reds, who failed to get a hit after the fifth inning, couldn't capitalize on their opportunity as Ryan Hanigan flied out and Donald Lutz grounded out.

Cincinnati, which had its win streak end at five games, got a solid performance from Johnny Cueto. The right-hander held the Cubs scoreless through the first six innings, but Luis Valbuena started Chicago's rally with a two-out RBI single off Cueto in the seventh.

"We went as far as we could with Johnny," Baker said of Cueto.

The Reds appeared headed for a clean eighth inning when reliever Logan Ondrusek retired the first two batters. Starlin Castro, though, kept the frame alive with a single and scored on a double by Anthony Rizzo. Alfonso Soriano then tied things up with a home run to center field.

Cincinnati plated all its runs in the fourth inning against Chicago starter Matt Garza.

Jay Bruce got the scoring started with his seventh home run of the season, a lined smash to the right-field seats.

Garza then hit the next batter, Frazier, before walking Xavier Paul in front of Hanigan, who sent a Garza pitch to center field for an RBI single. David DeJesus nearly made an acrobatic catch on the play, but the ball was just out of his reach.

After throwing a wild pitch, Garza fanned Cueto for the second out. With first base open, the Cubs opted to intentionally walk Shin-Soo Choo in order to face Zack Cozart. The move backfired, however, as Cozart delivered a two-run double to left.

Garza was removed after the Reds' fourth-inning outburst, and like Cueto, made his second start since a stint on the disabled list. He gave up four hits, walked four and struck out seven.

Game Notes

The Cubs beat the Reds for only the third time in the last 19 matchups ... Cincinnati second baseman Brandon Phillips went 0-for-4 to snap his hitting streak at 12 games ... Cueto scattered four hits and walked two ... The Reds left 11 men on base.