Alex Rodriguez knew it had been a while since he last hit a home run. Entering Monday night, the 40-year-old DH hadn’t hit a ball over a fence in 51 at-bats since June 18 in Minnesota.

Then he led off the second inning of the Yankees’ 2-1 win over the Orioles with a 423-foot no-doubter into the leftfield bleachers against Kevin Gausman.

“I haven’t hit a ball like that in a long time,” said Rodriguez, who has 696 career home runs. “It certainly felt good. A lot of times you come out and do work and you don’t get results; you may get a walk or a base hit. To get a ball in the air feels really good.”

Rodriguez was seen doing work on the field with hitting coach Alan Cockrell before batting practice was canceled because of a passing storm. The goal of the drill was for him to use his legs and elevate the ball.

Mechanics have been Rod riguez’s personal enemy this season, leading to his work with Cockrell and assistant hitting coach Marcus Thames. “Alan and I have been working a lot over the last two weeks on the mechanics,” A-Rod said. “Mechanics have been a humongous struggle for me all year. It’s been an uphill battle. It’s been hard for me to get the ball in the air consistently.”

His work ethic has never come into question. He frequently has put in extra time during a season-long slump in which he’s hitting .216 in 199 at-bats.

advertisement | advertise on newsday

Ivan Nova, who pitched six innings of one-run ball in the win, said Rodriguez “wants to be out there playing, swinging the bat.” Nova has taken notice of his desire to get better, and he’s not the only one who has seen results.

“Being able to see him coming through like that of course is huge,” Carlos Beltran said. “What I have seen about him in the past games that he has played, he has been taking his ‘A’ swing all the time.”

Joe Girardi has had to balance giving Rodriguez at-bats in opportune situations and putting the best product on the field. That has forced him into a glorified platoon role, though his success against Gausman was promising. At the point that he homered, he was 6-for-12 with three homers and a double against the righthander.

Yankees videos

Girardi has been pleased with Rodriguez’s swings on the current homestand.

“Well, I think for hitters, you can watch a lot of video and you can try and study your swing, but there’s a comfort factor,” he said. “You know when you feel good at the plate, you know when you feel right.”

Rodriguez still has much to prove before he can be considered remotely close to hot, but that swing arguably was his best in the past month. If he’s truly getting comfortable, maybe he can add some thump to a lineup in desperate need of production.