NEW YORK -- Phil Hughes had to have a short memory on Friday.

The right-hander hadn't made it past the fifth inning in his last two starts, and on Friday, one truly awful throw led to a four-run third inning. But like good pitchers are taught, Hughes forgot about the past, earning his 12th win in the Yankees' 6-4 win over the Red Sox.

After Dustin Pedroia's three-run home run in a third inning that was extended by Hughes' errant throw to second, he set down 13 of the last 15 batters he faced.

"Those games don't carry over. I just knew I needed to win this game and do the best job I can," said Hughes, who allowed four runs, but none earned due to his error. "Then I was kicking myself for throwing the ball into center field. Other than that, I used my changeup a lot more than I have all year this game just to keep guys off-balance."

The decision to use his changeup helped him settle down from the start, something Hughes has struggled with all season. He set down the first six Boston hitters until he reached the third. Pitching with a 3-0 lead, Mike Aviles broke for second. In all the commotion, Hughes mishandled Scott Podsednik's tailor-made double-play grounder, botching the transition from his glove to his throwing hand and sending a chopping throw into center field.

"The play's there. I asked him what happened, and when he went in and got [the ball] ... he got it way back in his palm, and he still tried to throw it," Girardi said. "He realized after he threw it that he should've went to first base when he went in and didn't get it correctly."

The Red Sox took advantage of the extra outs afforded to them by Hughes' throwing error, cashing in on Pedro Ciriaco's fielder's-choice grounder that brought home Aviles. Then came Pedroia's go-ahead three-run home run on a ball that Hughes left over the plate.

"I just didn't make a good pitch to Pedroia," Hughes said. "You can live with the one run coming in with nobody out, but you're trying to escape that inning with no more damage, especially after having the lead."

Once the damage was done, Hughes buckled down. He shut down the Red Sox over his final four innings, not allowing a runner to reach second base after the home run.

"I thought he really pitched tonight," Girardi said. "He threw more changeups tonight than he's probably done in four or five starts combined. He threw them to right-handers, to left-handers and really kept them off-balance. He mixed in a couple curveballs. He used his fastball effectively. He pitched great."