SAN FRANCISCO — Travis Ishikawa hit a rocket to right field, and it was time to dust off the famous Russ Hodges call: “The Giants win the pennant!”

Put Ishikawa’s name in the history books as the latest player to send the Giants to the World Series with a game-ending homer. In a Bobby Thomson moment of sorts, Ishikawa’s ninth-inning blast off Michael Wacha gave the Giants a 6-3 victory over the Cardinals in Game 5 of the NL Championship Series.

“When I first hit it, I thought it was going to be a walk-off hit, so I was throwing my hands up in the air,” Ishikawa said. “I remember hearing the crowd just going crazy, and so my thought was, ‘If this gets out, it’s going to be fantastic.’

“The last thing I remember was being thrown down with my jersey ripped off and then finally I was just so out of breath from yelling and screaming, and I had to have guys help me stand back up and finish celebrating.”

Your browser does not support iframes.

Wacha, who hadn’t pitched in 20 days, entered to start the ninth and allowed a leadoff single to Pablo Sandoval before Brandon Belt walked with one out. Ishikawa then ended it with the Giants’ third homer of the night.

“I put [Wacha] in a tough place without getting much work here lately,” Cardinals manager Mike Matheny said. “That’s on me.”

It will be the Giants and Royals playing for the World Series trophy beginning Tuesday in Kansas City. The Giants will be seeking their third World Series title in five years after not winning one in their first 52 seasons in this city.

Ishikawa was with the Giants when they won the world championship in 2010, but he wasn’t re-signed after the season. He returned this year as a part-time player who was thrust into a new position, left field, late in the year after Michael Morse was injured.

“I mean, what a great story,” manager Bruce Bochy said. “He gets released, we sign him, he goes to Fresno, comes up, he’s our everyday left fielder and ends up getting the home run to get us to the World Series.”

Morse brought an eruption that could be heard all the way to Alcatraz with a pinch-hit homer against Pat Neshek leading off the eighth to make it 3-3. Adam Wainwright had retired the last 10 batters he faced and was at 97 pitches, but Matheny went with the right-hander Neshek to start the eighth.

Morse, who did not start in this series after returning from a strained oblique, hit a blast into the left-field seats for the Giants’ second homer of the game. They had entered with only one homer the entire postseason.

Madison Bumgarner, who held the Cardinals to three runs over eight innings for his second strong performance in the NLCS, was named the series MVP.

“That was as fun a game as you could have, I think all the way around,” Bumgarner said. “It was awesome.”

Wainwright allowed two runs on four hits with two walks and seven strikeouts over seven innings. In his previous two starts, Wainwright — who has battled elbow discomfort — had pitched to an 8.00 ERA. Included was a loss to the Giants in Game 1 of this series.

Wainwright’s signature curveball was particularly sharp in the middle innings, with the right-hander striking out four straight batters beginning with Bumgarner in the fifth.

Tony Cruz’s homer in the fourth gave the Cardinals a 3-2 lead, only moments after Matt Adams had gone deep to tie the game.

Adams, who made two throwing blunders in the Cardinals’ Game 4 loss a night earlier, lofted a shot into the right-field seats leading off the fourth. Bumgarner then got two outs before Cruz launched a shot into the left-field seats.

The Giants used thunder to take a 2-1 lead in the third, when Joe Panik hit a shot just inside the right-field foul pole for a two-run homer. The blast was the Giants’ first in seven games — since Belt’s homer in the 18th inning of Game 2 of the NLDS in Washington.

It was the first homer this postseason for the rookie Panik, a former St. John’s standout and Hopewell Junction, N.Y., native.