MINNEAPOLIS -- Eddie Rosario finished a single shy of the cycle and drove in three runs to help the Minnesota Twins snap a four-game skid with a 9-5 victory over the Seattle Mariners on Thursday night.

Aaron Hicks and Brian Dozier also homered for the Twins, who had lost 10 of their previous 12 games. Phil Hughes (10-6) gave up five runs on 10 hits and struck out five in five innings and Joe Mauer extended his hitting streak to 11 games.

Austin Jackson and Seth Smith hit two-run homers for the Mariners, who traded outfielder Dustin Ackley to the New York Yankees before the game. J.A. Happ (4-6) gave up seven runs -- six earned -- on nine hits in 3 1/3 innings.

Glen Perkins pitched a scoreless ninth after a couple of shaky outings and Rosario nearly became the first Twins player to hit for the cycle since 2009 when he ripped a line drive in the eighth inning. But shortstop Brad Miller made a highlight reel stab to prevent it.

Both starters were hit hard early and often, with Smith opening things with a two-run homer off of Hughes in the first inning.

The Twins came right back with five off of Happ in the bottom half of the inning, sending nine men to the plate and getting a leadoff homer from Dozier and a three-run shot from Rosario.

Hicks went deep in the second inning for Minnesota, Jackson hit a two-run homer in the fourth for the Mariners and Rosario scooted home in the fifth when second baseman Chris Taylor misplayed a grounder from Eduardo Escobar with the infield drawn in that put the Twins up 8-5.

Perkins converted his first 28 save chances, but scuffled out of the All-Star break with two blown saves and six earned runs allowed in his four outings.

The Mariners are buried in the AL West, so they shipped Ackley to the Yankees for prospects Ramon Flores, an outfielder, and Jose Ramirez, a right-handed pitcher.

Meanwhile, Twins GM Terry Ryan said he had "every intention" of making a deal before the trade deadline on Friday afternoon. The Twins' biggest needs are in the bullpen and at shortstop.