ST. LOUIS -- Standing in front of his locker, St. Louis third baseman Matt Carpenter was asked if he ever had a chance to hit for the cycle before.

"I don't know ... maybe in T-ball?" he joked.

Carpenter didn't get that opportunity Sunday, as he stood on deck while the third out of the bottom of the eighth inning was recorded. But that was fine with him and the Cardinals.

Carpenter's three hits and three RBIs, capped by a two-run double in the sixth, were just enough as St. Louis hung on by its cuticles for a 7-6 win over San Diego at Busch Stadium.

Cardinals starter Adam Wainwright (15-7) tied Cincinnati's Johnny Cueto for the league lead in wins, going seven innings. Wainwright allowed seven hits and four runs, three earned, with a walk and five strikeouts.

St. Louis nearly hacked it up in the ninth. Struggling closer Trevor Rosenthal, who came within a replay review of blowing a save chance in Thursday night's 4-3 win, walked the bases loaded with one out and was pulled by manager Mike Matheny.

Seth Maness promptly allowed a two-run single to center fielder Abraham Almonte, cutting the Padres' deficit to a run. Left fielder Seth Smith then slashed a ground ball that appeared ticketed for right field and a game-tying hit.

But first baseman Matt Adams dove and knocked the ball towards second baseman Kolten Wong, who threw to Maness at first for the second out. Catcher Yasmani Grandal then flew out to left fielder Jon Jay, giving Maness his second save.

Following the game, Matheny immediately shot down any notion that Rosenthal would be removed as the closer.

"That's not happening," Matheny said. "You know, he's had some tough innings that he's been able to get out of. It just might be a bit of a timing issue (with his delivery) and maybe some confidence. It was just one of those days that we had to get him some help."

Rosenthal, who entered the game tied for third in MLB with 36 saves, said that he is going through a rough stretch.

"Everything feels right," he said. "Maybe I need to make an adjustment. I'm just glad Seth was there to pick me up."

The Cardinals (66-57) expanded their lead on San Francisco for the National League's first wild-card spot to 1 1/2 games, pending the outcome of the Giants' home game with Philadelphia. They also stayed in second place in the NL Central behind Milwaukee.

St. Louis came out swinging against Odisramer Despaigne (3-4), cuffing him for five hits and four runs in the first. Jay poked a two-run single to right with the bases loaded, while center fielder Peter Bourjos and catcher Tony Cruz added two-out RBI hits.

Carpenter cranked out his seventh homer off the top of the right-center field wall in the second for a 5-0 lead. With Wainwright retiring the first 11 men he faced, it seemed like an easy day for the Cardinals.

But San Diego (58-65) has scored more runs than any NL team but Pittsburgh since the All-Star break, and it got to Wainwright in the fifth and sixth. Four singles generated two runs in the fifth, with shortstop Alexi Amarista and third baseman Yangervis Solarte bagging RBIs.

First baseman Jake Goebbert tripled for the second time in as many games in the sixth, driving home second baseman Jedd Gyorko to make it 5-3. Goebbert was awarded home when second baseman Wong's relay throw bounced into the seats for an error.

"He's a great pitcher, always has been," Goebbert said. "But I think we executed our plan against him better the second and third time around. We lost three of four here, but we could have won three of four."

Instead, it was St. Louis earning three of four despite some nervy moments at the end Sunday.

"That's a good team we played," Matheny said of the Padres. "You look at their record since the All-Star break ... they have been relentless on offense. This was a big win for us."

NOTES: St. Louis recalled RHP Carlos Martinez from Triple-A Memphis and optioned LHP Kevin Siegrist to Memphis. Martinez is 2-4 with a 4.74 ERA in 38 appearances for the Cardinals this year. Siegrist took the loss Saturday night and is 1-3 with a 6.11 ERA. ... San Diego lost for just the sixth time in 48 games when scoring four or more runs, a better winning percentage than every MLB team but the Washington Nationals. ... St. Louis LF Matt Holliday, mired in a 0-for-18 slump, did not start Sunday as Jon Jay moved from CF to LF. Peter Bourjos took over in CF. Holliday's last hit was in the ninth inning Monday night at Miami against the Marlins.