San Francisco back in NLCS

The Giants' Hunter Pence makes a difficult catch against the wall in the sixth inning as fans look on during San Francisco's series-clinching victory over the Nationals on Tuesday night at AT&T Park.

Photo: Ezra Shaw / Getty Images

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

The wild-card Giants took Game 4 in the best-of-5 Division Series and eliminated the Nationals by scoring on a bases-loaded walk, a groundout and a wild pitch. Hunter Pence turned in a defensive gem in right field.

Santiago Casilla put the potential tying run aboard in the ninth on a two-out walk to Bryce Harper, 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.

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.