Updated

SAN FRANCISCO (AP) — Freddy Sanchez hit a tiebreaking, two-run single in the seventh inning after earlier getting hit in the face by a spiked cleat, Aubrey Huff added a solo home run and the San Francisco Giants rallied to beat the Washington Nationals 5-4 on Thursday.

John Bowker started the comeback when he reached on an error by Washington first baseman Adam Dunn leading off the seventh against Nationals' starter Craig Stammen. Bowker took second on a passed ball, moved to third on a groundout then scored on pinch-hitter Nate Schierholtz's RBI single. Andres Torres followed with a double to move Schierholtz to third before Sanchez's second hit of the game drove in both runners.

Dunn hit his 10th homer of the season but was denied No. 11 after umpires used instant replay to uphold their original ruling.

Santiago Casilla (1-0) pitched 2-3 of an inning to get the win in relief of starter Barry Zito. Guillermo Mota pitched one scoreless inning and Brian Wilson worked the ninth for his 12th save in 13 chances.

The Giants bounced back nicely a night after ace and reigning two-time NL Cy Young winner Tim Lincecum was roughed up in a 7-3 loss to the Nationals.

Though Zito struggled with his command and didn't factor in the decision, San Francisco overcame an early two-run deficit — not to mention several bursts of rain showers — to win for only the second time in eight games.

Sanchez, who missed all of spring training and the first 38 games of the season recovering from left shoulder surgery, is a big reason why.

The Giants' second baseman made several stellar plays defensively and shook off taking a cleat to the face while trying to tag out Justin Maxwell on an attempted steal in the second inning.

It was Sanchez's offense that made the biggest difference, though. He singled and scored on Juan Uribe's hit in the first inning then walked in each of his next two at-bats before driving in the go-ahead runs off Washington reliever Sean Burnett (0-2).

Sanchez, who has hit safely in five of the seven games he's played in since returning from a rehab stint in the minors, raised his average 58 points to .250.

Zito, who had lost two of his previous three starts, gave up two home runs and walked five. The lefty scattered seven hits over 6 1-3 innings with three strikeouts and was charged with all four Washington runs.

Washington starter Craig Stammen, who gave up three runs and five hits in 6 1-3 innings, pitched well but also was gone when the game ended. The right-hander walked three and remains winless since April 19.

The Nationals took a 3-1 lead early and appeared to add to it when Dunn lofted a high fly ball to right-center field. The ball sailed high and bounced off the top of the wall in right-center before bouncing back onto the field.

Dunn rounded first then appeared to slow into a home run trot before stopping at second when first base umpire Casey Moser ruled the ball in play. After Washington manager Jim Riggleman came out to argue the call, Moser met with the other three umpires and the quartet left the field to watch the replay before returning with their ruling.

NOTES: The Giants recalled RHP Waldis Joaquin from Triple-A Fresno before the game in an attempt to fortify their leaky bullpen with LHP Jeremy Affeldt unable to pitch for several days because of a sore left hamstring. INF Matt Downs was optioned to Fresno to make room for Joaquin. ... INF Ryan Rohlinger was also added to the roster, replacing Edgar Renteria, who was put on the 15-day DL with a strained right hamstring.