Having been bottled up offensively since arriving in the Bronx, Josh Donaldson picked a perfect time to break out.

His homer in the seventh off Jose Ramirez put the A’s up for good as they rolled to their fifth consecutive victory, 7-4, over the New York Yankees on Wednesday.

The long ball has been very good to the A’s so far this series. They got two from cleanup hitter Yoenis Cespedes on Wednesday as they roared back from a 4-1 deficit. That came after Brandon Moss’ two-homer game the night before.

Donaldson arrived at Yankee Stadium after a torrid homestand, and three games in the New York spotlight provided the opportunity to build on his impressive All-Star resume. But his only hit through his first eight at-bats in the series came on a first-inning dribbler Wednesday. That changed when he took Ramirez deep for his 16th homer of the season.

The comeback made a winner of Jesse Chavez (5-3), who navigated through six innings despite allowing Jacoby Ellsbury’s three-run homer.

The A’s once again showed why they’re leading the majors in runs scored, as they scored in a variety of ways and put themselves in position for another series sweep if they can take care of business in Thursday’s matinee.