Updated

Denard Span's two-run double during a four- run seventh inning vaulted the Minnesota Twins to a 5-4 win over the AL East- leading New York Yankees in the second test of a three-game set.

With the bases loaded and two outs in the deciding frame, Yankees manager Joe Girardi pulled starter Phil Hughes in favor of left-hander Boone Logan, who was unable to hold a 3-1 lead.

Joe Mauer capped the seventh -- and his three-hit night -- with an RBI single, and Glen Perkins survived Andruw Jones' pinch-hit solo homer in the ninth to close out Minnesota's third win in four contests.

The Yankees' second setback in three games, coupled with the Orioles losing to Toronto on Tuesday, keeps New York 1 1/2 games ahead of Baltimore in the division race.

Esmerling Vasquez gave up a two-run homer to Nick Swisher, but was otherwise solid in his six-inning start for the Twins, allowing just six more hits and one walk.

Casey Fien (2-1) was credited with the win despite surrendering Russell Martin's leadoff homer in the seventh, while Hughes (16-13) had a three-start winning streak halted after getting charged with four runs on six hits.

"Our guys are rising to the occasion," Twins manager Ron Gardenhire said. "If you can't get up for (the Yankees), you can't get up for anything."

Swisher broke a scoreless game when he followed Robinson Cano's leadoff single in the fourth with his 24th homer of the year.

Mauer scored on Chris Parmelee's bloop double in the bottom half, and Martin got the run back by taking Fien's first pitch into the bullpen over the left- field wall for his career high-tying 19th home run.

But the Twins solved Hughes in the home seventh, which began with Ryan Doumit singling and Parmelee working a walk. Jamey Carroll loaded the bags with a one-out single, and Logan entered after Hughes struck out Pedro Florimon Jr.

"I was hoping (Girardi would keep me in), but I don't make those decisions," Hughes said.

With Span at the plate, Logan sent one through Martin's legs for a wild pitch, allowing Doumit to score. Span then worked the count full and found the gap in right to knock in Parmelee and Carroll with the tying and go-ahead runs, respectively.

A walk to Ben Revere preceded Mauer's RBI single to right, which wound up as the game-winner after Jones went deep in the ninth.

Perkins struck out Jayson Nix to pick up his 15th save of the year.

Game Notes

Mauer also threw out a pair of potential base stealers ... Swisher has homered in four of his last six games ... Martin also had 19 home runs in 2007 with the Dodgers ... Cano went 3-for-3 with a walk ... Derek Jeter went 1-for-4 to extended his hitting streak to 19.