Anthony Swarzak knew he had trouble with Curtis Granderson. Not this much trouble.

Granderson hit three home runs in the first four innings and matched a career high with five hits, leading the New York Yankees to a 7-6 victory over the Minnesota Twins on Thursday night.

Granderson homered in each of his first three at-bats, driving in four runs, and helped Phil Hughes overcome a four-run first inning to secure his first victory of the season.

Swarzak gave up two of those homers in his shortest outing of the season — 2 2-3 innings.

"He sees the ball pretty well off me, apparently," Swarzak said. "I guess I'm going to have to do something different against him next time. Maybe I'll throw the ball left-handed."

Ryan Doumit, who also hit a two-run homer, had a two-run single and Danny Valencia followed with a two-run double to give the Twins a 4-0 lead in the first, but Swarzak (0-3) gave it back.

Granderson homered to right-center and Mark Teixeira hit his first home run of the year, a two-run shot in the first that landed nearly in the same spot in right-center as Granderson's. The Yankees center fielder then hit a soaring two-run homer in the second.

"Maybe there were a couple of good pitches in there, but I don't think too many good pitches end up in the seats," Twins manager Ron Gardenhire said. "The kid can hit. You get it down there in that zone for him, he can turn on a baseball. That's a nice porch out there for left-handed hitters and he took full advantage of it."

Derek Jeter had an RBI single as the Yankees earned a split of the four-game set. The Twins have not won a series in New York since 2001, a year before Gardenhire took over as manager.

"A disappointing night that we couldn't get this third game from them. But we'll take the effort," Gardenhire said. "The guys had a good effort tonight."

Granderson got two chances to tie the major league record of four homers in a game. In the sixth, he lined a single to right field. In the eighth, with much of the remaining crowd standing, he beat out a dribbler down the first base line. He was then caught stealing.

In the fourth, Granderson hit a line drive to the short right-field porch against Jeff Gray and came out of the dugout for a curtain call. Granderson is the first player to hit three homers in a big league game this year.

"A lot of work went into today before we actually stepped onto the field. Had some big issues with timing," said Granderson, who came in hitting .208 with three homers.

He became the 12th major leaguer to hit three home runs in the first four innings of a game, according to STATS LLC and the SABR Home Run Log. Alfonso Soriano was the last to do it for the Chicago Cubs on June 8, 2007, against Atlanta.

"What he did today is a special day," New York manager Joe Girardi said. "He should cherish it."

Mariano Rivera, the fifth Yankees pitcher, worked a perfect ninth for his third save of the season and record 606th of his career.

For the third time in this series, the Yankees fell behind in the first. Doumit hit a two-run single to left that beat the shift. The Twins had loaded the bases on a single, a throwing error by second baseman Eduardo Nunez and a walk.

Valencia then hit a long double to left-center on an 0-2 pitch to make it 4-0.

Fighting to keep his spot in the rotation with Andy Pettitte and Michael Pineda getting closer to being ready to join the team, Hughes (1-2) gave up six runs and six hits — two earned — in 5 1-3 innings.

"It was far from a good outing, but there are some positives I can take out of it," Hughes said.

Swarzak had pitched better than his record suggested, receiving only one run of support in each of his first two starts, but he struggled from the start in this one. He gave up six runs and eight hits.

"All I want to do is give my team a chance to win and when you give up six runs in the first two innings, that's asking a lot," Swarzak said. "We came up one run short and I'll wear it."

Twins shortstop Jamey Carroll made a diving stab of Jeter's grounder in the first and an over-the-shoulder, diving catch on Robinson Cano's pop to shallow left field in the second.

Doumit hit a two-run homer off Hughes in the sixth to cut the lead to 7-6.

"In this park, it's fun to hit," Doumit said.

NOTES: The teams combined for 19 runs in the first inning of this series. ... Twins CF Denard Span broke his bat tapping it on home plate during his at-bat leading off the game. ... Joe Mauer went 1 for 5 on his 29th birthday.