Some way to bust out of a slump.

Alex Rodriguez, who had looked every bit his 40 years for the last three weeks, cracked a game-changing grand slam in the seventh inning, sending the Yankees to an 8-4 victory over the Twins in front of 38,007 Tuesday night at the Stadium.

A-Rod broke an 0-for-18 skid. "I've been stinking up the joint the last three weeks,'' he said. "A home run feels great, a grand slam feels awesome, especially to do it late and help us win a game.''

The Yankees (66-52) maintained a one-game lead in the AL East over the Blue Jays, who beat the Phillies.

The Yankees entered the seventh trailing 4-1 but rallied against what has been a mostly awful Twins bullpen, particularly in the season's second half.

Chase Headley, pinch hitting for Stephen Drew, started the rally with a single and Brendan Ryan followed with a walk. Jacoby Ellsbury flew out and Brett Gardner walked to load the bases. Paul Molitor called on righthander J.R. Graham to face Rodriguez, in a 14-for-92 (.152) slide, with only one homer and five RBIs since turning 40 July 27, including 1-for-27 heading into the at-bat.

A-Rod got ahead 1-and-0 before driving a 95-mph fastball to centerfield for his 25th homer and extending his MLB record with his 25th slam. The blast, which drew a curtain call from the suddenly noisy crowd, put the Yankees ahead 5-4.

"It's the thing that hitters go through,'' Joe Girardi said of Rodriguez's slump. "You have to ride out the good times and the bad times. Huge hit tonight. Sometimes it can get you going again. A little success helps.''

The Yankees added three runs in the eighth against Graham, getting a two-run double from Headley and an RBI single from Ellsbury.

Andrew Miller, who came in with two outs in the eighth and the Yankees ahead 5-4, pitched a scoreless ninth for his 27th save.

CC Sabathia, while not quite as good as in his previous two starts, in which he allowed a total of three runs, pitched well enough. He allowed four runs and five hits in 62/3 innings. He left with a 3-1 deficit that became 4-1 when Nick Rumbelow let an inherited runner score.

"I thought he threw a good game,'' Girardi said of Sabathia. "His stuff is crisper, his location is better.''

Sabathia actually took a perfect game into the fifth. Trevor Plouffe walked with one out and, after Torii Hunter struck out, Eduardo Escobar flared a single to right that put runners at the corners. Kurt Suzuki ripped a double into the corner in left. Plouffe scored to make it 1-1 and, with the No. 9 hitter coming up, coach Gene Glynn waved Escobar around, even though he was just hitting the bag as Didi Gregorius was taking the relay. Gregorius threw a strike to John Ryan Murphy, who easily tagged out the runner.

With the score 1-1, Sabathia opened the seventh by walking Joe Mauer. Miguel Sano, a 22-year-old rookie who started the season with Double-A Chattanooga, jumped on a first-pitch changeup and swatted it into the seats in left for his ninth homer.

Former Met Mike Pelfrey, who came in 6-7 with a 3.70 ERA, held the Yankees to one run and five hits but was let down by his bullpen.

The Yankees opened the scoring in the fourth. Carlos Beltran doubled with one out. Rookie first baseman Greg Bird, who had two hits, sent a full-count fastball to right for his first career RBI to make it 1-0.