Yankees rightfielder Aaron Judge looks for his pitch against the Red...

Yankees rightfielder Aaron Judge looks for his pitch against the Red Sox during the first inning of a game at Yankee Stadium on Tuesday. Credit: Kathleen Malone-Van Dyke

The Yankees got one of their big guns – their biggest one – back just in time for the stretch run.

Aaron Judge, out since July 27 with a right wrist fracture, cleared his final hurdle Tuesday morning in a simulated game and was in the starting lineup for Tuesday night’s game against the Red Sox.

“I felt like I never left,” Judge said. “That’s all you can really ask for after missing so many weeks.”

Judge, who batted second and played rightfield, hit a couple of balls hard but went 0-for-4 in the Yankees’ 3-2 win that kept the Red Sox, for one night at least, from clinching the AL East title at the Stadium.

“Obviously, we don’t want that to happen,” said Neil Walker, who hit a three-run homer off reliever Ryan Brasier with one out in the seventh inning that turned a 1-0 deficit into a 3-1 lead. “At the same time we’ve got to take care of business. We need to get back on track.”

On this night, the Yankees, 8-11 in their previous 19 games, looked headed in that direction.

J.A. Happ, acquired in part because of his success against Boston, was terrific, allowing an unearned run and four hits over six innings. He lowered his ERA with the Yankees to 2.39. Chad Green and David Robertson got the ball in the ninth to Zach Britton, who survived a bizarre ninth to pick up his sixth save, despite two errors, one by him.

The Yankees messed up two apparent double plays, first when second baseman Gleyber Torres couldn’t handle the throw of third baseman Adeiny Hechavarria, a defensive replacement before the inning for Miguel Andujar, and then when Britton fielded a chopper and threw past Torres. Britton, known for his hard sinker that gets an inordinate number of grounders, started a 1-4-3 double play to end the suspense.

“I’ve been there before,” Britton said. “I get a lot of ground balls, sometimes they find holes or things happen. You just have to make a good pitch.”

The Yankees (92-58) are 2 1/2 games ahead of Oakland for home-field advantage in the wild-card game, and 10½ games behind the Red Sox (103-48) in the AL East.

But the big-picture story of the night was the return of Judge. In his first at-bat, against Nathan Eovaldi, he sent a liner to right, which came off his bat at 112 mph but straight at J.D. Martinez.

“It’s like riding a bike,” Judge said of seeming comfortable in the box immediately. “That’s what I’m getting paid to do.”

Said Gary Sanchez: “I saw the Judge I’m used to seeing.”

With two on and one out in the third, Judge swung at a first-pitch fastball and into a 6-4-3 double play. With Torres at second and one out in the sixth, Judge flied to the track in right, which allowed Torres to get to third. Judge struck out against righty William Cuevas in the eighth while trying to check his swing on a 3-and-2 pitch.

Earlier in the day, before the start of the rainstorm that pushed the start time to 7:05 from 1:05, Judge participated in a simulated game. The session was watched by most of the Yankees’ hierarchy, including general manager Brian Cashman and manager Aaron Boone.

Judge served as a defensive replacement in Friday’s victory over the Blue Jays but was not yet deemed ready to bat in a game. That changed Tuesday after a second successful sim game in as many days.

“We still have some pain, there’s going to be some pain probably until the offseason,” Judge said. “But it’s something I can deal with, and it’s not affecting my swing or anything like that.”

More Yankees headlines