Updated

Josh Donaldson's tie-breaking solo home run in the top of the eighth inning provided the winning margin in the Oakland Athletics' 5-4 victory over the New York Yankees in the rubber match of a three-game series.

Oakland belted three homers in all on the day, with Yoenis Cespedes clubbing a two-run shot and Luke Montz finishing 2-for-4 with a solo blast that helped the A's to a fifth triumph in seven contests.

Sean Doolittle (2-0) picked up the win after firing a perfect bottom of the seventh in relief, with Grant Balfour holding the Yankees scoreless in the ninth to register his fifth save of the year.

"We got contributions across the board today in different ways," said Oakland manager Bob Melvin. "Sometimes it takes a whole group to win a ballgame, and today that was the case."

Boone Logan (2-2) was dealt the loss for serving up Donaldson's go-ahead homer, with Andy Pettitte reached for four runs -- three earned -- while walking four over five innings in a second straight shaky start for New York.

Pettitte was tagged for seven runs on 10 hits through 4 1/3 frames in a 9-1 Yankees' setback to Houston on Monday.

"Everything has been great in my [bullpen sessions], but something is going on in the games," Pettitte said afterward. "I can feel my release point floating around. You just know from the feel of your fingers, the ball is just not coming off right. It has been a long, long time since I haven't had a feel for my pitches."

Robinson Cano and Ichiro Suzuki each had two hits and an RBI for New York, which concluded a 10-game homestand at 7-3, while Lyle Overbay delivered a two-run single in defeat.

With one out in the top of the eighth, Donaldson broke a 4-4 deadlock by crushing a 2-1 fastball from Logan that landed just inside the foul pole in the second deck in left field.

Ryan Cook protected the one-run edge despite encountering a jam in the bottom of the eighth, striking out Jayson Nix with two on and one out and getting Overbay to fly out to the warning track in right center to end the threat.

New York also put two men aboard against Balfour in the ninth, with Brett Gardner singling with two out and taking second on a wild pitch in front of an intentional walk to Cano. The Oakland closer fanned Vernon Wells swinging, however, for the final out.

"[Wells] is a good hitter. He's had plenty of success in his career," said Balfour. "Just trying to make it difficult on him, make good pitches. At first there, I was trying to get him to hit a ground ball. When I got later in the count, I'm looking to punch him out."

The Yankees had tied the game via a three-run bottom of the sixth, with Cano starting the rally with a single before being erased on Wells' fielder's choice grounder. Travis Hafner then worked a walk to force A's starter Dan Straily's departure, and Suzuki greeted reliever Jerry Blevins with a double into the right corner that brought home Wells.

Blevins rebounded with a key strikeout of Nix, but Overbay ended an eight- pitch at-bat with a base hit to short center that plated both runners and knotted the score at 4-4.

Straily was charged with three runs allowed on four hits and three walks over his 5 1/3-inning stint.

Pettitte managed to avert damage in each of the initial two innings, striking out Nate Freiman with the bases loaded to end the top of the first and stranding Montz following a leadoff double in the second. He couldn't escape out of trouble in the third, however, after walking Derek Norris to start the frame and hitting Jed Lowrie in the foot with a pitch.

Cespedes then hit a potential double-play grounder to short, but Cano's relay to first was off the mark to enable Norris to cross with the game's first run.

The Yankees evened things up in their half of the inning, when Gardner reached on a two-out bloop double and crossed the plate on Cano's sharp single to center.

Montz put the A's back in front after taking Pettitte's full-count offering over the wall in left to open the fourth, and Cespedes made it a 4-1 Oakland lead an inning later by following a walk to Lowrie with a blast into the visiting bullpen.

Game Notes

Yankees shortstop Eduardo Nunez was removed from the game after four innings due to tightness in his left rib cage ... Montz's homer was his second in the majors, with the other coming at Philadelphia on Sept. 28, 2008 while then with Washington ... Oakland's Josh Reddick doubled in the ninth inning to break an 0-for-33 lifetime skid at the current Yankee Stadium, the longest hitless streak by any player in the venue's history ... Preston Claiborne relieved Pettitte and tossed two perfect innings in his big league debut ... The Yankees fell to 11-3 in games decided by two runs or less, with two of the losses coming in this series.