CHICAGO -- Yadier Molina hit a tiebreaking, two-out, two-run single in the ninth inning, leading the St. Louis Cardinals to a 5-4 win over the Chicago Cubs on Sunday.

The St. Louis catcher, who was moved up to the No. 2 spot in the lineup to try to jump-start the St. Louis offense, came to the plate with the bases loaded. Cubs reliever Hector Rondon (0-1) got ahead in the count 1-2, but Molina hit a two-seam fastball up the middle just past diving shortstop Starlin Castro to drive in Randal Grichuk and Mark Ellis.

The win was only the second in six games for the Cardinals (16-16).

St. Louis closer Trevor Rosenthal earned his eighth save in as many chances despite letting the potential tying run reach base. Cubs center fielder Emilio Bonifacio drew a walk with two outs and advanced to second on defensive indifference. Third baseman Luis Valbuena followed with an RBI double to cut St. Louis' lead to 5-4. However, first baseman Anthony Rizzo grounded out to end the game.

Kevin Siegrist (1-1) got the win after striking out the side in the eighth.

Rondon issued a one-out walk to Grichuk and gave up a single to Ellis to set up a prime opportunity for St. Louis. Rondon struck out center fielder Peter Bourjos, but he walked third baseman Matt Carpenter on four pitches to load the bases, bringing up Molina.

Cubs starting pitcher Jason Hammel surrendered three runs on seven hits with five strikeouts and two costly walks. Both walks, which came with two outs in the second and third innings, led to runs that helped the Cardinals take a 3-0 lead.

St. Louis starter Lance Lynn held the Cubs to two runs on three hits in his six innings. He struck out five, but he walked four.

The Cubs (11-18) tied the game at 3 on reliever Carlos Martinez's wild pitch with two outs in the seventh inning. Valbuena hit a two-out triple, and Martinez intentionally walked Rizzo to bring up Castro. Martinez threw a curveball that Molina couldn't corral, allowing Valbuena to score easily to tie the game. Martinez struck out Castro to strand the go-ahead run at second.

Amid 40-degree temperatures at Wrigley Field, command issues plagued both starting pitchers, especially Hammel.

Cardinals shortstop Jhonny Peralta walked and advanced on a wild pitch with two outs in the second, and he scored on center fielder Grichuk's triple to put St. Louis on top. Ellis followed with an RBI double.

In the third, St. Louis extended its lead. Left fielder Matt Holliday walked with two outs. First baseman Matt Adams drove home Holliday with a double, but Hammel limited the damage by striking out right fielder Allen Craig to end the inning.

Hammel helped himself in the fourth inning against Cardinals starter Lance Lynn. With one out, left fielder Ryan Kalish reached on a single, catcher John Baker walked, and both advanced on second baseman Darwin Barney's groundout. Hammel connected on a fastball for a two-run single to right field, cutting the Cardinals' lead to 3-2.

It was Hammel's first RBIs since 2011, when he drove in four that season as a member of the Colorado Rockies.

Lynn found trouble in the third when his command suddenly became a problem. He retired Barney on a fly ball to start the inning, but then walked Hammel, Bonifacio and Valbuena to load the bases. Valbuena came back from an 0-2 count to draw the walk, and it set up a bases-loaded opportunity for hot-hitting Rizzo.

Lynn got Rizzo to fly out to shallow center field, and Castro swung at the first pitch he saw, flying out to right field to end the inning.

NOTES: Cardinals RHP Jason Motte (Tommy John surgery) threw a scoreless inning Sunday for Double-A Springfield. He threw 13 pitches and struck out all three batters he faced. ... St. Louis LHP Jaime Garcia (left shoulder) exited his rehab start Sunday at Double-A Springfield early. While batting, Garcia was hit by a pitch on his left elbow, and he taken to a nearby hospital for precautionary X-rays. In his two innings, Garcia allowed two runs on three hits, including a home run. He also walked one batter and struck out two. ... The teams wore throwback jerseys designated after the 1929 models. That year, the Cubs reached the World Series.