SAN FRANCISCO -- The San Francisco Giants are on another October roll in their every-other-year pattern of postseason success.

Joe Panik scored the go-ahead run in the seventh inning on Aaron Barrett's bases-loaded wild pitch, and the Giants edged the Washington Nationals 3-2 Tuesday night to return to the NL Championship Series.

The wild-card Giants won 3-1 in the best-of-five Division Series by also scoring on a walk and a groundout.

Hunter Pence turned in a defensive gem in right field that helped hold the Nationals at bay as San Francisco won for the 11th time in its last 12 postseason games.

"It's been a remarkable journey. I wouldn't trade it for the world," Pence said. "If it was easy, it wouldn't be as fun."

San Francisco travels to St. Louis for Game 1 on Saturday. It's a rematch of the 2012 NLCS, when the Giants rallied from a 3-1 deficit to beat the Cardinals on the way to their second World Series championship in three years.

Santiago Casilla walked Bryce Harper with two outs in the ninth, then retired Wilson Ramos on a grounder to end it. Casilla was mobbed on the mound as fireworks shot off from the center-field scoreboard.

Harper splashed a tying home run into McCovey Cove in the seventh, but Washington's season ended with a third straight one-run defeat, including that excruciating 2-1 loss in 18 innings Saturday in Game 2.

The Nationals' offense never got on track, lacking the power that carried them to an NL East title and the best record in the league at 96-66.

"It's tender and it's bitter and all of those things, but I'm proud of them," rookie manager Matt Williams said.

After his wild pitch snapped a 2-all tie, Barrett got set to intentionally walk Pablo Sandoval. But the right-hander sailed a toss way over the head of Ramos, who quickly retrieved the ball near the backstop. Ramos threw to Barrett covering the plate, where he tagged out a sliding Buster Posey.

The call was upheld after a replay review of 1 minute, 57 seconds, denying San Francisco an insurance run.

"It was just one of those weird plays where they ended up getting me," Posey said.

Just like a night earlier when Giants ace Madison Bumgarner's one miscue cost his team the game, Barrett blew it this time.

Triumphant When It Counts The NLCS kicks off Saturday between the two most successful postseason clubs over the past five years. Below, the MLB teams with the most playoff wins since 1999: 1. Cardinals 30 2. Giants 26 3. Rangers 18 4. Tigers 17 5. Red Sox 11

Pence produced the play of the night when he slammed his back into an archway on the right-field wall to rob Jayson Werth of extra bases in the sixth.

Fans enjoying the game from the outside portwalk witnessed the catch from just behind Pence and broke into frenzied cheers.

"That catch he made was unreal. It really brought momentum back in our favor," Posey said.

The very next inning, Pence could only watch as Harper hit a towering drive over the right-field arcade and between two boats among a large group of kayakers in the cove. It was the 104th splash homer at 15-year-old AT&T Park and third in the postseason.

Rick Ankiel did it for the Braves in the 2010 NLDS.

Hunter Strickland, the rookie reliever who gave up Harper's solo home run to the third deck in the seventh inning of Game 1 and then later said he would challenge the slugger again if given the chance, got his opportunity Tuesday and paid for it.

Harper crushed a 3-1 pitch from Strickland and appeared to give the pitcher a look as he rounded the bases. Harper celebrated in the dugout and shouted out toward the field.

"It's a 2-1 game, I hit the home run in the seventh, of course I'm going to go crazy. I don't even know what I'm doing," Harper said. "They beat us, so the home run was nothing."

Strickland still did enough to earn his first postseason victory. Sergio Romo pitched a perfect eighth and Casilla closed it out before the celebration began.

Bumgarner, hat on backward, took off from the dugout and ran along the left-field fence and all the way around AT&T Park to lead a victory lap of Giants players slapping hands. Sandoval pumped his arms in the air and waved to fans.

"I think anyone that's here tonight sees what type of electric atmosphere this is, and we just love playing in front of these fans," Posey said.

San Francisco fans cheered when the rival Dodgers were eliminated by St. Louis at Busch Stadium earlier Tuesday, putting the Cardinals in their fourth straight NLCS. They went crazy once their Giants clinched another chance to play for the pennant, and the city is counting on the Giants' every-other-year trend of winning it all.

San Francisco won the World Series in 2010 and again 2012. The team's 10-game postseason winning streak, a record for NL teams, was snapped with a 4-1 loss to the Nationals on Monday.

The Giants began their latest playoff run with a wild-card win last Wednesday night in Pittsburgh.

Williams, groomed in the Giants' system as a player, and his stunned players head home to the nation's capital after a much quicker exit than they envisioned.

Giants starter Ryan Vogelsong didn't allow a hit until Ian Desmond's leadoff single in the fifth, the Nationals' second baserunner. Harper followed with a sharp double down the left-field line to put Washington on the board.

Pinch-hitter Nate Schierholtz walked two outs later and Vogelsong received a mound visit from pitching coach Dave Righetti before retiring Denard Span.

Winless in September, Vogelsong returned to his top postseason form. Pitching for the first time since Sept. 26 after going 0-4 in five September outings, Vogelsong allowed two hits in 5 2-3 solid innings.

The 37-year-old journeyman has not allowed more than one earned run in five postseason starts, winning Games 2 and 6 of the 2012 NLCS and Game 3 in a World Series sweep of the Tigers.

"That's as clutch as it comes," Pence said. "It's not an accident that he has the success he does in the playoffs. He's one of those tough, hard-nosed, gritty guys."

Nationals starter Gio Gonzalez found several ways to hurt his own cause in the second. The Giants loaded the bases after Brandon Crawford's one-out single before Gonzalez misplayed Juan Perez's slow dribbler for an error. Vogelsong beat out a bunt single that went untouched and then Blanco drew a four-pitch walk to force home the first run.

UP NEXT

Bumgarner and Jake Peavy are the likely candidates to start Game 1 of the NLCS for the Giants against Adam Wainwright.

QUIET PANDA

Sandoval's 14-game postseason hitting streak was snapped with an 0-for-3 night.