ST. LOUIS — The Chicago Cubs had their chances, but just couldn’t get the big hit.

The Cubs stranded 10 runners, including leaving the bases loaded in the second and fourth innings, as the St. Louis Cardinals rallied for a 4-2 win Tuesday night, ensuring that the runaway Cubs won’t clinch the NL Central at Busch Stadium.

Chicago’s magic number is three, and the series in St. Louis wraps up Wednesday.

“We put together some really good at bats tonight,” Chicago shortstop Addison Russell said. “It’s just you’ve got to give credit to their pitchers, too. They kept us off balance it seemed like, and made the plays.”

St. Louis remained a half-game behind the New York Mets for the second NL wild-card spot.

Cardinals reliever Alex Reyes’ lack of control led to most of the Cubs’ chances. Reyes (2-1), who pitched 4 1/3 innings of relief after Jaime Garcia failed to get out of the second, walked six and allowed a hit but still managed to keep the Cubs off the board.

“The fastball command wasn’t there,” Cubs manager Joe Maddon said. “We were out of the zone. We had every opportunity had we been a little more patient.”

Cubs starter Jason Hammel (14-9) struck out a season-high nine, but gave up two-run homers to Brandon Moss in the sixth and Aledmys Diaz in the second.

“The pitch to Diaz was a fastball that came back over the plate,” Hammel said. “The pitch to Moss I went back and looked at it and I felt I made my pitch and it just left the yard. I’ve got to figure out how to keep it on the ground.”

Dexter Fowler led off the game with a home run against Garcia. It was his seventh leadoff homer of the season.

“I’m seeing the ball well,” Fowler said. “Control what you can control and other than that you’ve got to keep pushing.”

Garcia lasted just 1 2/3 innings in the shortest outing in his 146-start career. He gave up two runs on three hits, including an RBI double by Russell in the second.

“I let my team down,” Garcia said. “I’ve been through tough times before. All I can say is I’m going to continue to do what’s in my control to continue to fight.”

Moss entered the game mired in a 1-for-41 skid. He singled in the second and scored on Diaz’s 15th homer of the season.

“It was a bad rut, but he pulled himself through,” Cardinals manager Mike Matheny said.

Diaz started for the first time since July 31, when the All-Star shortstop broke his thumb.

Kevin Siegrist got his second save.

The loss means the earliest the Cubs can clinch their first National League Central Division championship since 2008 would be Thursday against Milwaukee at Wrigley Field.

“It’s going to happen,” Fowler said. “It’s just a matter of when.”

TRAINER’S ROOM

Cardinals: INF Matt Carpenter was in the starting lineup after leaving Monday’s game with back tightness. … RHP Trevor Rosenthal threw batting practice. He has missed 46 games with shoulder inflammation. … RHP Michael Wacha is expected to be activated off the disabled list tomorrow and could be headed to the bullpen. He has been out since Aug. 9 with shoulder inflammation.

UP NEXT

Cubs LHP Jon Lester (16-4, 2.51) takes on RHP Carlos Martinez (14-7, 3.05) in the final game of the three-game set. Lester has allowed one run or less in each of his last five starts. He is 6-0 with a 1.17 ERA in his previous eight starts. Martinez is 6-3 in 11 day starts this season. He has induced an NL-leading 32 double plays.