Alex Rodriguez spent his All-Star break far from the baseball diamond, hobnobbing with the U.S. women's soccer team at the ESPYs and participating in a skit in which he apologized for everything, from a character's death in "Game of Thrones" to the economic crisis in Greece.

Friday night, it was back to work. Suffice it to say, A-Rod looked less the comedian and more the All-Star.

Rodriguez homered for the go-ahead run in the seventh as the Yankees defeated the Mariners, 4-3, at the Stadium.

"I'm rested, I'm healthy and it definitely felt good tonight," he said. "I don't know if I needed it . . . [but] the rest was very beneficial for me, especially when I was gone serving my suspension and maybe the four days [helped].

"But I don't think tonight was about me. I thought tonight we had some very good pitching, some very solid defense."

Rodriguez also singled and scored in the fifth, It was his 3,021st hit, moving him past Rafael Palmeiro for 24th place on the all-time list.

Masahiro Tanaka (6-3) got the victory, allowing three runs and five hits in seven innings. Two of the hits were homers to Kyle Seager, who drove in all three of Seattle's runs.

"The at-bats against Seager were just bad pitches and he got the best of them," said Tanaka, who said he was otherwise pleased with his performance. "I really wanted to come out strong."

Dellin Betances pitched a 1-2-3 eighth with two strikeouts. Andrew Miller allowed a two-out single to Mark Trumbo in the ninth, but struck out Jesus Montero for his 19th save in as many chances.

With the Yankees down 3-2 in the fifth, Rodriguez led off with a single. Mark Teixeira walked and Brian McCann hit an RBI single to right to tie it.

Rodriguez put the Yankees ahead for good in the seventh with a one-out homer off Joe Beimel (0-1) who relieved Mike Montgomery to start the inning. Rodriguez hit a 1-and-0 fastball to the Yankees bullpen in right-center. It was A-Rod's 19th homer.

"That's a big hit and Alex has that ability to hit the ball [to] any part of the ballpark," manager Joe Girardi said. "It gets the second half started right."

That homer gave Tanaka his second win in a row, despite stretches in which he looked less than masterful.

Tanaka loaded the bases in the second on two walks and Austin Jackson's single. But with two outs, he struck out Mike Zunino on an 87-mph slider.

The Yankees scored in the bottom half when Chris Young hit his 11th homer, a shot to leftfield on Montgomery's waist-high fastball to give the Yankees a 1-0 lead.

Seager tied it in the third with a solo shot to rightfield.

Young came about 2 feet shy of hitting his second homer in the fourth, but settled for a double. He scored on Chase Headley's chopper up the middle for a 2-1 lead.

But Tanaka, who has been susceptible to the one big inning in his previous two starts, was instead victim to the one big batter. Seager blasted a two-run homer to give the Mariners a 3-2 lead in the fifth. It was Seager's sixth career multihomer game and his second this season.