SAN FRANCISCO -- Welcome to National League baseball, Eduardo Nunez.

On a day when his manager used 11 players in the No. 9 spot in the lineup, Nunez made his first big contribution to his new team Saturday, stroking a two-run double that ignited a comeback and led the San Francisco Giants to a 5-3 victory over the Washington Nationals.

"That's the reason they brought me here," Nunez boasted after his second game as a Giant following a Thursday trade from Minnesota. "To win games."

The third game in the four-day series began shortly after the Nationals announced a trade of their own, acquiring closer Mark Melancon from the Pittsburgh Pirates in exchange for a two left-handers, major-leaguer Felipe Rivero and minor-leaguer Taylor Hearn.

"We're getting some reinforcements," Nationals manager Dusty Baker proclaimed after he'd been unable to use two of his best relievers, Sammy Solis and Shawn Kelley, on Saturday because of overuse.

Giants manager Bruce Bochy had no such problems with his bullpen.

Six relievers combined to shut out the Nationals on three hits and two walks over the final five innings, allowing the Giants to win for the first time in three tries in the series and only the third time since the All-Star break.

Derek Law (4-1), the fourth Giants pitcher, was credited with the win after pitching one shutout inning. Closer Santiago Casilla worked a 1-2-3 ninth for his 23rd save.

"The bullpen won the game for us," Bochy said.

Making his first start for the Giants, Nunez notched his first hit leading off the bottom of the first and stole his 28th base of the season.

But his biggest hit came in the fourth with San Francisco, which suffered 4-2 and 4-1 losses to the Nationals the two previous days, trailing 3-0.

Brandon Belt led off the fourth with his second of three walks. After Joe Panik singled and pinch hitter Mac Williamson walked to load the bases, Nunez lined a double that got the Giants to within 3-2.

"That's what wins ballgames for you," Bochy observed. "Somebody comes through with a big hit. Nunez got us back in the ballgame. That just lifts the ballclub."

Angel Pagan's infield out completed a three-run inning and tied the score.

With relievers Matt Reynolds, Hunter Strickland and Law combining to keep the Nationals at bay, the Giants put up the two difference-making runs in the last of the seventh against Washington reliever Yusmeiro Petit.

Buster Posey's second infield hit, a walk to Hunter Pence and a single by Belt loaded the bases with one out.

Joe Panik broke the tie with a sacrifice fly. Two batters later, pinch hitter Trevor Brown drew a bases-loaded walk from Blake Treinen, making it 5-3.

Javier Lopez, Sergio Romo and Casilla held on from there to help the Giants snap a three-game losing streak.

"That's a huge win with what's been happening," said Bochy, whose team took the field with the worst record in the majors (2-11) since the All-Star break.

"It was one of those games when I felt we needed to throw everything out there. Normally you don't take out your starter in that situation (the bottom of the fourth inning of a 3-0 game), but we've got to score."

Petit (3-2), a former Giant, took the loss.

The Nationals took their early 3-0 lead on the strength of Anthony Rendon's two-run home run in the third inning off Giants starter Jake Peavy, and Danny Espinoza's RBI double in the fourth.

Peavy lasted only four innings, allowing three runs on five hits. He walked one and struck out seven.

Nationals starter Reynaldo Lopez, promoted from Triple-A Syracuse earlier in the day, also went only four innings. He gave up three runs on four hits and five walks. He struck out four.

"They were due to hit some with runners in scoring position," Baker said of the Giants, deflecting any criticism from Lopez, who was making only his second major league start.

Pence, returning from a 48-game absence because of a strained left hamstring, had a double and a walk in two at-bats.

Trea Turner had two hits for the Nationals, who had a three-game winning streak snapped.

NOTES: The 11 players used by the Giants in the No. 9 spot in the lineup Saturday included seven pitchers, three pinch hitters and a pinch runner. ... Giants INF Eduardo Nunez also popped out and flied out with the bases loaded. He stranded a total of seven baserunners on a day when the Giants went 2-for-13 with runners in scoring position. ... The Nationals were 0-for-7 with runners in scoring position. ... Nationals LF Jayson Werth had an eighth-inning single to extend his streak of having reached base at least once to 33 games. ... The Nationals made their change at closer Saturday despite the fact that they began the day with the lowest bullpen ERA in the National League (3.05) and the second-highest save percentage (75.7). ... Nationals 2B Daniel Murphy (sore right leg) and Giants SS Brandon Crawford (bruised left hand) sat out the game. ... The Giants designated 2B Ramiro Pena for assignment to create a roster spot for RF Hunter Pence, who was reinstated from the disabled list before the game.