PITTSBURGH -- Francisco Cervelli hit his second career grand slam, Gerrit Cole pitched seven solid innings and the Pittsburgh Pirates beat the St. Louis Cardinals 8-2 in a doubleheader opener to put St. Louis' NL Central title hopes on hold.

The Cardinals' magic number remained at two for their third straight division championship after the Pirates jumped on Michael Wacha (17-7).

Cervelli delivered the big blow, a shot to left field with the bases loaded in the fourth.

More from FoxSports

Neil Walker also homered for the Pirates, who moved within three games of St. Louis for first and inched closer to homefield advantage in next week's wild-card game.

Cole (19-8) allowed two runs and seven hits in seven innings in likely his final regular-season start.

Matt Carpenter hit a 435-foot solo homer off Cole in the sixth that bounced into the Allegheny River but the Cardinals could do little else against Pittsburgh's ace, who will almost certainly get the call against the Chicago Cubs in the wild-card game if the Pirates don't overtake St. Louis for the division crown.

Pittsburgh blew a chance to apply pressure on the frontrunning Cardinals on Monday, when the Pirates stranded 16 runners in a 3-0 loss that assured St. Louis the Central title barring a historic collapse.

Manager Clint Hurdle altered his rotation slightly, sending Cole out to start the day-night opener rather than Charlie Morton, who was bumped to the nightcap.

Cole retired his first nine batters, giving the Pirates a chance to get to the normally unflappable Wacha. The right-hander has dominated Pittsburgh, including a dazzling performance in Game 4 of the 2013 NL Division Series with the Cardinals facing elimination.

The stakes weren't quite as high this time, and Wacha wasn't quite as crisp. Walker led off the second with his 16th homer, and Wacha's control abandoned him in the fourth.

Andrew McCutchen led off with a single and Aramis Ramirez walked. Wacha intentionally walked Pedro Alvarez to load the bases with one out, and Cervelli sent the second pitch into the bleachers to put the Pirates up 5-1. Gregory Polanco added an RBI double later in the inning.

Wacha allowed six runs, four hits and four walks in four innings.

TRAINER'S ROOM

Cardinals: RHP Adam Wainwright returned from a five-month stay on the disabled list and gave up one run in the eighth, his first appearance out of the bullpen since 2006.

The three-time All-Star tore his left Achilles on April 25, an injury that was thought to sideline him until 2016. Wainwright made it back well ahead of schedule, and manager Mike Matheny expects Wainwright to be in the mix to start in the playoffs barring a setback.

That's fine by the 34-year-old Wainwright, who called his grueling rehab "not a fun deal" but one that could pay off in October.

"The silver lining is my arm got some great rest and I'm healthy now," he said. "All this is preseason for the real season coming up, right?"

To make room for Wainwright the Cardinals placed RHP Carlos Martinez on the 60-day disabled list with a right shoulder strain.

UP NEXT

The Cardinals take another shot at wrapping up the division in Game 2 when they send out Tyler Lyons (2-1, 3.96) to face Morton (9-8, 4.54). Lyons has an ERA of 4.93 in seven starts this year and a 1.76 ERA in eight relief appearances. Morton is just 2-11 against St. Louis and hasn't beaten the Cardinals since April 4, 2011.