Updated

The Miami Marlins rallied to score three runs in the eighth inning and defeat the San Francisco Giants, 6-3, in the second of a four-game set at AT&T Park.

Tied at 3-3 and with Jake Dunning (0-1) pitching for the Giants, Ed Lucas singled to center with one out in the eighth and Giancarlo Stanton was hit by a pitch.

Javier Lopez then came on in relief. He struck out Logan Morrison, but was replaced by Jean Machi, who gave up Marcell Ozuna's RBI single to right. Pinch-hitter Greg Dobbs then singled up the middle, plating Stanton.

Next up was Adeiny Hechavarria, who hit an infield single and the Giants' Joaquin Arias made an errant throw to first, allowing Ozuna to score.

A.J. Ramos (1-2) pitched a flawless seventh inning to pick up the win and Steve Cishek escaped trouble in the ninth to notch his 12th save.

Morrison had a home run and two RBI and Ozuna also drove in two runs for the Marlins, who saw starter Ricky Nolasco allow three runs on nine hits and two walks over 5 2/3 innings.

San Francisco starter Tim Lincecum fanned eight and gave up three runs on four hits and a walk in seven frames. Marco Scutaro, Hunter Pence and Nick Noonan had an RBI apiece in the setback.

"We just had a hard time getting that last out tonight," said Giants manager Bruce Bochy.

Morrison's leadoff homer in the second put the Marlins on the board.

However, the Giants scored a run in the second and third innings, respectively. With the bases loaded and one out in the second, Noonan grounded into a fielder's choice to first, but plated Pence. Scutaro ripped an RBI double to right in the third.

Two innings later, Pence smacked an two-out RBI double to right center.

Miami came back in the sixth. Lucas singled with one out and scored on a two- out triple by Morrison. Ozuna then hit an infield single, scoring Morrison and tying the game.

The Giants had a chance to retake the lead in the home half. Torres doubled to lead off but was thrown out trying to take third. Lincecum hit a two-out triple to right center, but Gregor Blanco struck out to end the frame.

In the ninth, Cishek gave up a leadoff single to Noonan. After pinch-hitter Brandon Belt struck out, Blanco hit a blooper up the middle and Scutaro's grounder to the pitcher put the tying run at the plate. However, Posey's grounded out to third to end the game.

"They made a little run at the end like you knew they would," said Marlins manager Mike Redmond. "We were fortunate enough to have a cushion. It got a little hairy at the end. They crowd got into it and it was fun."

Game Notes

Arias went 0-for-4, ending an 11-game hitting streak ... The Marlins hit 4- for-10 with runners in scoring position while the Giants were 1-for-14 with RISP ... The Giants have lost nine straight to the Marlins at AT&T Park. Their last win came on July 28, 2010.