BALTIMORE: The New York Yankees honored Gene Michael by wearing black arm bands, and then paid homage to the man nicknamed “Stick” by winning a game for him.

Aaron Judge and Chase Headley hit two-run homers, Starlin Castro and Todd Frazier added solo shots and New York beat the Baltimore Orioles 9-1 on Thursday for its first series win at Camden Yards in four years.

Michael, who played, coached, managed and served as general manager for the Yankees, died of a heart attack Thursday at age 79.

Current manager Joe Girardi, who had a tight relationship with Michael, said his friend would have loved New York’s victory.

“That’s a Stick special. That’s exactly what that is,” Girardi said. “Make pitchers work and hit home runs. We were able to do that. So that was for Stick.”

Didi Gregorius had three hits and scored twice for the Yankees, who closed within 3 1/2 games of AL East-leading Boston and fortified their grip on the top AL wild card.

Yankees leadoff hitter Brett Gardner appreciated putting on the gray New York uniform just a little bit more on this day, knowing how much Michael meant to his storied franchise.

“You see it hanging in your locker and then when you put the jersey on you take a minute to remember and appreciate,” Gardner said. “Obviously, that represents Stick today but in the past we’ve had all sorts of guys it’s represented. I’m sure he’d be happy about how the game went.”

Sonny Gray (9-9) gave up one unearned run and six hits in 5 2/3 innings. The right-hander is 3-4 since he was acquired by New York in a July 31 trade with Oakland.

After rain postponed Wednesday night’s game, the Yankees dominated the makeup from the outset. Judge connected in the first inning for a 3-0 lead, giving him 39 home runs — second-most by a rookie in major league history behind Mark McGwire’s 49 in 1987.

“There’s been a couple at-bats this series they left a couple over the middle that seemed to miss and I didn’t swing at,” Judge said. “My mindset today was to go out and be aggressive.”

New York added two runs in the third against Kevin Gausman (10-10), and Headley’s drive off Mike Wright made it 7-0 in the fourth.