ST. LOUIS (AP) — Yadier Molina hit an RBI single off second baseman Darwin Barney’s glove with two outs in the ninth inning and the St. Louis Cardinals beat the Chicago Cubs 7-6 Tuesday, avoiding a sweep and an 0-5 homestand.

Alfonso Soriano, who hit 26 home runs last year, tied it for the Cubs with his first of the season leading off the ninth against Jason Motte (2-1).

READ MORE: Illinois Moves Into 'Bridge Phase' Of Reopening Friday

Matt Carpenter’s second homer in four games off James Russell had put the Cardinals up in the eighth.

The Cubs scored three runs in the first, and there were later four ties before the Cardinals won.

Matt Holliday also homered on a three-hit day, Allen Craig had three hits and two RBIs and Tyler Greene snapped an 0-for-17 skid with three hits, including a double and triple for St. Louis.

The NL Central leaders are just 9-8 at home after prevailing in a game that was tied at 3, 4 and 5. The four-game losing streak, which began with two defeats against Atlanta, was the franchise’s worst a seven-game slump June 10-17 last year against three teams.

Bryan LaHair hit his 10th homer, half of them against the Cardinals, and Reed Johnson contributed his second go-ahead pinch hit in three days with an RBI single in the seventh. The rookie has reached base safely in 32 consecutive games.

READ MORE: Man Fatally Shot In Grand Boulevard

Holliday singled off Cubs closer Rafael Dolis (2-3) to start the ninth and advanced on David Freese’s one-out groundout. Molina’s grounder to the right side deflected off Barney’s glove and rolled into shallow right field, and Holliday scored without a play.

The Cubs have lost 10 of 14 in St. Louis dating to June 3, 2011. Dolis is 3 for 6 in save chances.

The Cardinals capitalized on Kerry Wood’s wildness to tie it again in the seventh. Wood has 11 walks in 8 1-3 innings after issuing passes to Rafael Furcal and Holliday, and Craig tied with a one-out single. Craig had an RBI double in the first and has an extra-base hit in eight of his 12 games.

Holliday put the Cardinals ahead with his seventh homer in the fifth, a drive to left estimated at 445 feet. He also singled in the first and is 6 for 29 against Paul Maholm but with three homers and six RBIs.

Kyle Lohse trailed by a run after his first seven pitches produced three hits with an RBI single for Starlin Castro. Soriano and Ian Stewart also drove in a run apiece and the Cubs had 11 swings and no misses while going up 3-0.

MORE NEWS: Chicago Weather: Temperatures In The 70s Return

(© Copyright 2012 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)