NEW YORK — Alex Rodriguez arrived at Yankee Stadium on Friday afternoon to a throng of reporters waiting to ask him for a comment.

“Tell me what happened,” Rodriguez said, puzzled.

He was directed to a television monitor in the clubhouse that was broadcasting Andy Pettitte’s news conference announcing that he would retire at the end of the season. Pettitte and New York Yankees manager Joe Girardi were making assurances that the weekend, festooned with farewell tributes, would not be a distraction. The sideshow, this time, would not involve Rodriguez, and Rodriguez did not seem to notice the sideshow.

But then, of course, his presence would have to be felt this week, wouldn’t it? With all the drama, the pomp and the circumstance. After all, the final nine games could be his valediction, too.

And, on cue, Rodriguez reinjected himself into the Yankee conversation in typically marquee fashion. His grand slam in the seventh inning lifted the Yankees past the San Francisco Giants, 5-1, lifting their faint postseason hopes.

The grand slam was Rodriguez’s 24th, sending him past Lou Gehrig for first place on the career list.

“It’s hard to think about things like that,” Rodriguez said. “We’re really on a sprint to the end here, and every win is huge for us.”

The day began with the announcement of Pettitte’s retirement, which, along with the long-awaited ceremonies for Mariano Rivera on Sunday and next week, creates a tricky balancing act for the club. There are still very important games to play. The Yankees, who seem to be constantly reminding themselves not to look ahead, cannot afford to lose focus looking back.

Of course, that vacuous middle ground is an uneasy backdrop for this final home stand, straddling the belief that there will be postseason life and the reality that it may be now or never for goodbyes.

But if there is one Yankee who seems unencumbered by reality — or the notion of goodbye, for that matter — it would be Rodriguez. While he did not know about Pettitte, he did know that he was in a 1-for-22 skid entering the game.

“I’ve been missing balls, hitting high, towering fly balls,” Rodriguez said. “I thought my legs were a little better today.”

The Yankees were 3 1/2 games behind in a berth for a wild card coming into the day, with five teams ahead of them fighting for two spots. According to MLB.com, they had a 1 percent probability of making the postseason.

“It’s time to go,” starter C.C. Sabathia said. “We need to try to win out.”

Sabathia did everything he could, holding the Giants to one run in seven-plus innings. But San Francisco’s starter, Tim Lincecum, was just as effective, even if he is no longer firing mid-90s fastballs as he did in his prime.

The Giants had not visited the Bronx since 2002, and Lincecum had never before faced the Yankees. As a Washington native, he said, he grew up rooting for Rodriguez when the rising star played for the Mariners.

“At a young age, it’s kind of hard not to know about guys like that,” Lincecum said. “It was a little surreal.”

Lincecum retired Rodriguez three times earlier in the game. But he got in trouble in the seventh. Eduardo Nunez led off with a single to right and stole second base, putting himself into scoring position with one out. But Giants third baseman Pablo Sandoval made an impressive sliding stop on a grounder down the line by J.R. Murphy, forcing Nunez at third, on Lincecum’s 116th pitch.

Five pitches later, Lincecum walked Ichiro Suzuki, loading the bases. Giants manager Bruce Bochy brought in reliever George Kontos to face Rodriguez. On a 2-1 fastball, Rodriguez sent his home run out to right.

“It’s a huge hit,” Girardi said. “I don’t know how many more we can afford to lose, and we’re in a very tight game with C.C. and Lincecum, a very good matchup, and we needed a big hit.”

Said Sabathia: “It was vintage. It felt good to be able to see him do that. That was a big moment.”

With such monumental importance on each game, the timing of the Pettitte announcement certainly complicated things. A large media gathering attended Pettitte’s early-afternoon news conference. Some Pettitte highlights were shown on the video board during the game.

Girardi said he did not believe the additional hoopla and the buildup for Sunday’s start would deter Pettitte’s routine or the focus of his teammates.

“That’s not what he wanted,” Girardi said before the game. “We thought it was important for him, because Andy understands what the fans have meant to his life and his family’s life and he wanted to say thank you. And we all thought that this was the proper way.”