The Yankees' Aaron Hicks is greeted in the dugout after...

The Yankees' Aaron Hicks is greeted in the dugout after his two-run home run against the Athletics during the seventh inning of an MLB game at Yankee Stadium on Monday. Credit: Kathleen Malone-Van Dyke

A visit from the A’s is a good, if temporary, cure for an ailing offense. The return of Aaron Judge figures to be a more permanent one.

The Yankees hit four home runs against the worst pitching staff in MLB on Monday night at Yankee Stadium, defeating the A’s, 7-2 — a fitting prelude to Judge’s much-anticipated return from the injured list Tuesday.

Oswaldo Cabrera, Gleyber Torres, DJ LeMahieu and Aaron Hicks homered against the hapless A’s, also owners of the worst record in baseball. The best news for the last-place Yankees, though, came hours before first pitch when Judge confirmed that he is set to come off the injured list as soon as he is eligible. The Yankees optioned lefthander Nick Ramirez to Triple-A Scranto/Wilkes-Barre after the game, likely to make room for Judge.

Judge, who hurt himself on April 26 while attempting to steal third with a headfirst slide against the Twins, said he hasn’t felt any pain in five or six days. The only difference he expects is that he’ll try to go feet-first in the future, he said. No guarantees, though.

“I try to, but it’s kind of instinct,” a jovial Judge said Monday. “I don’t know what happens. I tell myself to slide feet-first and I feel like I’m going to be out so I kind of just dive. I was trying to get to the base. I can’t promise you guys it won’t happen again, but I’ll try to . . . I’m just happy to be back.”

The Yankees’ offense showed some life after coming into the day with the seventh-worst OPS and fourth-worst on-base percentage in MLB.

Judge’s presence is an obvious and immediate upgrade, and having him back against the A’s with the AL East-leading Rays on deck is a tantalizing bonus. The A’s are owners of the worst ERA in baseball at 7.26 (the second- worst belongs to the White Sox at a comparably modest 5.66).

The Yankees, though, did take their time exploiting that weakness. They made hard contact against former Yankee JP Sears early but ran into some tough breaks and didn’t pull ahead for good until Torres’ sixth-inning homer broke a tie at 2.

In fact, the Yankees didn’t get a runner into scoring position until Harrison Bader’s leadoff triple in the fifth. Oswaldo Cabrera then teed off on an inside sweeper and drove it 339 feet to left for his second homer of the season and a 2-0 lead.

Nestor Cortes settled down after a rocky first inning and pretty much cruised until the sixth, when he allowed the first three hitters to reach. Ron Marinaccio then allowed a soft RBI infield single to Tony Kemp. One out later, after getting ahead of Jace Peterson 1-and-2, Marinaccio walked him to tie it at 2 before getting Nick Allen to bounce into a double play.

In a bounce-back from his worst start as a Yankee, Cortes, who had strep throat last week, allowed two runs and six hits with two walks and four strikeouts in five innings plus three batters.

Whatever tenuous grasp Sears had on the Yankees’ lineup disappeared the third time around the order as the Yankees scored three runs in the sixth. With one out, Torres rocketed a middle-middle fastball at 111.7 mph to left for a 378-foot solo home run to break the tie. Anthony Rizzo singled and LeMahieu followed with his fourth homer, a 402-foot shot that made it 5-2.

Hicks hit a two-run homer in the seventh, a no-doubt 393-foot shot into the second deck in rightfield. After picking up his first extra-base hit on Sunday, a double, he now has his first home run.

“We’re the Bronx Bombers — it’s kind of what we’re known for, to hit home runs and score a lot of runs that way,” Hicks said. “I’m just trying to be a little bit more patient and trying not to force things.”

It was a strong performance against a team the Yankees should beat, but it also might herald the return of that little bit of swagger they have been missing of late — especially with Judge’s imminent return.

It’s getting “an MVP player back,” Boone said. “It’ll be fun to write his name in the lineup. There’s just that presence he has, being our leader — certainly one of our leaders and guys look to him. I think there’s a tangible element to him being back in there . . . but there’s also, I think, an intangible element that he brings.’’ 

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 5 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME