NEW YORK - Flashes from cameras and smartphones lit up Yankee Stadium in the sixth inning on Thursday night as Curtis Granderson neared history and fans wanted to record.

The Yankees center fielder had homered off of Twins righthander Anthony Swarzak in each of the first two innings and off of reliever Jeff Gray in the fourth. Granderson had a chance to become the 16th player in major league history to hit four homers in a game, so fans were at the ready.

He fell short in the sixth, only a single to right. Then he beat out an infield hit during his final at-bat in the ninth.

History wasn't made, but Granderson made the Yankees' night, as they needed all of his power to beat the Twins 7-6 and salvage a split of the four-game series.

"The kid can hit if you get it down there in that zone for him," Twins manager Ron Gardenhire said. "That's a nice porch for lefthanded hitters out there [in right field] and he made full use of it."

The Twins know Granderson well from when he played for the Tigers from 2004 to '09. He has gone from hitting 23 triples in a season, like he did in 2007, to hitting 41 homers last year. It's the 28th time a Yankees player as hit three homers in a game, the first since Alex Rodriguez in 2010. And no other Yankees player has ever hit three homers in a game in which he had five hits in all.

Granderson became the 24th opponent to hit three home runs in a game against the Twins, the first since Jose Bautista of the Blue Jays did it last season.

The Twins have done it four times.

"I've played a lot baseball, but I've never done what I did tonight," Granderson said. "So it's kind of cool. It's definitely a night to remember. I definitely will."

He was 3-for-4 against Swarzak entering the game.

"He sees the ball pretty well off me, apparently," Swarzak said. "And I gotta try to find a way to get him out. Maybe I'll switch and hit lefty the next time, I don't know."

Swarzak was frustrated. He was given a 4-0 lead -- can you believe the Twins led 2-0, 3-1, 4-0 and 4-0 in this series? -- but gave up three runs in both the first and second innings. He could only get his fastball over for strikes, which any team will feast off of.

The bullpen pitched 5 2/3 innings Tuesday and four Wednesday, so Swarzak went back out for the third, only to be removed with two on and two out.

"It's pretty easy to hit when you're hitting 2-0 and 3-1 all the time," said Swarzak, who gave up six runs on eight hits and a walk.

Granderson's third homer made it 7-4 in the fourth inning, but Ryan Doumit hit a two-run homer in the sixth to get the Twins within 7-6. Danny Valencia led off the eighth with a double but never came around to score. Chris Parmelee struck out, pinch hitter Sean Burroughs tapped out and Denard Span grounded out to end the inning.

Mariano Rivera entered in the ninth, and the best closer in baseball history retired the Twins in order to pick up his third save of the season, 606th all-time.

The Twins were able to split the series. But Thursday, they were either a better pitch or a clutch hit away from more.

"We expected to win today," Doumit said. "We were talking about that before the game. We wanted to win a series and we got off to a good start, but it's just one of those games where it didn't pan out for us. But to take two games in this park -- it's a pretty hostile environment here -- is pretty good."