Ryan Meara: “It’s just a battle. That was our mentality going into this little stretch and I think we came out on top.” (Bob DeChiara/USA TODAY Sports)

BOSTON — All things considered, it could not have worked out much better for the Red Bulls.

Over a span of a month, they played their three closest rivals — New York City FC, the Philadelphia Union and New England Revolution — six times, once each in Major League Soccer and once in the Lamar Hunt/U.S. Open Cup.

They came away with a sterling 4-1-1 mark, including a 1-0 triumph over the Revs at Jordan Field in the Open Cup quarterfinals Thursday night (the Red Bulls’ Open Cup win over Philly officially goes down in the record books as a tie because they advanced via a shootout).

“It probably helped us in a way, playing all those kind of teams,” said striker Bradley Wright-Phillips, who struck for the game-winner in the 87th minute Thursday. “They’re rivals. There’s bad blood between us. It’s easier to get up for the game when you’re playing these types of teams.”

The Red Bulls started their unusual journey against their most hated rivals with a 1-0 home win over NYCFC in the Open Cup June 14. They continued it with a 2-0 league result at the Union June 18 before Hudson River Derby enemy City registered a 2-0 win at Red Bull Arena June 24.

New York then eked out a 5-3 shootout win over Philadelphia after playing to a 1-1 tie over 120 minutes in the Round of 16 in the Open Cup June 28 before facing off against the Revolution in back-to-back matches in New England.

The Red Bulls defeated the Revs, 3-2, July 5, and then came Thursday night’s result.

“The last month or so has been a tough stretch for us, no doubt about it,” said goalkeeper Ryan Meara, who recorded the clean sheet. “Those are our three rivals. Those games are always going to be a little more heated. Then you throw into the occasion that three of those are Open Cup games, loser goes home.

“It’s just a battle. That was our mentality going into this little stretch and I think we came out on top. Now we’re looking forward to a game on Wednesday in league play. We’re looking forward to the semifinals. We have a good chance of winning it all.”

The Red Bulls host the San Jose Earthquakes, coached by former Red Bulls defender Chris Leitch, at RBA Wednesday.

And in case you’re wondering, the Red Bulls will meet NYCFC in another derby encounter at Yankee Stadium Sunday, Aug. 6.