Now batting sixth, Alex Rodriguez. And what better way to celebrate a demotion in the lineup than with a two-run home run?

While Yankees stars of yesteryear often complained about their spot in the order, Rodriguez, who hit third in every game he played this season until Sunday’s, did not. How could he when he came in hitless in his previous 19 at-bats and batting .100?

“Whatever Joe [Girardi] wants, I’m here to do, I love Joe,’’ Rod riguez said after a 4-3 victory over the Mariners snapped a four-game losing streak. “He knows best. He gave me some good advice and I hit a home run. So sometimes, you’ve got to do that, you got to shuffle the deck a little bit, and whatever it takes to win, I’m willing to do.’’

A-Rod’s second-inning homer erased a 1-0 deficit. With Brian McCann on first after being hit by a pitch, Rodriguez sent Hisashi Iwakuma’s first pitch into the leftfield seats for his second homer of the season. Iwakuma was opposing Masahiro Tanaka in Major League Baseball’s first pitching matchup of former Japanese teammates. Tanaka (1-0) pitched seven innings, and Dellin Betances and Andrew Miller struck out the side in the eighth and ninth, respectively.

The Yankees took a 3-1 lead in the third when Brett Gardner, who had three hits, doubled in Jacoby Ellsbury. The Mariners made it 3-2 in the fourth. Kyle Seager’s hard grounder went through the legs of first baseman Mark Teixeira for a two-base error, and Seager scored on Steve Clevenger’s single. In the fifth, Norichika Aoki tripled to center when Ellsbury’s diving attempt came up empty and the ball shot past him toward the wall. Seth Smith’s one-out single drove in Aoki to tie it.

“If he makes the catch, you say great play,’’ Girardi said of Ellsbury. “If he doesn’t, you’re going to question should he have dove for it. I thought he gave a really good effort and he came up a little bit short, so that doesn’t frustrate me.’’

The Yankees scored the go-ahead run in the sixth when Gardner came in on a wild pitch by Iwakuma (0-2).

Before the game, Girardi told Rodriguez he was going to bat Carlos Beltran third.

“I just let him know,’’ Girardi said. “He’d been struggling and Carlos had some success off of Iwakuma, so I just decided to make the change. As I said before the game, it’s not necessarily permanent. [Last year] Alex started seventh in our lineup and worked his way up. I just thought I would change it up a little bit today. I’m not sure what I’ll do on Tuesday.’’

Girardi had basically had it with questions about Rodriguez’s slump and inferences that he may be through as he approaches 41 in July. “Pressure comes from within, every player wants to do well,’’ Girardi said. “That’s where the most pressure comes from. He hit a two-run homer, so that was nice.’’

When pressed on his thought process in making the change, Girardi grew testy. “You know what, I went and saw a shrink,’’ he said. “And had him analyze what I should analyze and I went from there. That’s what I did.’’

Rodriguez said Girardi “told me to stop feeling for the baseball and try to drive it. It was good advice. I didn’t try to do too much.’’

He went 1-for-4 to raise his average to .119. “I thought my rhythm was better out there,’’ he said. “I got one hit but I felt my swings were better.’’

A-Rod is 11 homers shy of 700. “That’s the last thing I’m thinking about right now,’’ he said. “I’m just so happy I was able to contribute today and help us win the game.’’