"It just seems like every time they answer, we answer back," said Anderson, who had two walks, two runs scored and his first walk-off RBI. "There's been some hard-fought, very good games. It seems every time they jump out, we fight and claw and scratch our way back."
Steady all season, Anderson is batting .308 with four home runs and 33 RBIs.
"Obviously, he's going to keep growing, when he keeps getting in situations like that," Marlins manager Don Mattingly said. "Those are great moments for guys early in their careers. You may have been in that situation in Triple-A or Double-A, but obviously to be in that situation here [is different]."
Rojas got the ninth going with a two-strike single off Reyes Moronta, followed by a four-pitch walk to Yadiel Rivera, prompting the Giants to go to their closer, Hunter Strickland in a tie game. With one out, pinch-hitter J.B. Shuck reached on an infield single, loading the bases for Anderson, who lifted his sacrifice fly to center on a 3-1 offering.
"I know offensively, I'm not at my best right now," said Rojas, who is hitting .095 in June. "While I'm struggling at the plate right now, I have to find ways to help the team win games."
Getting in a favorable hitter's count, Anderson's concern was to get something in the air, and the Giants had their outfield playing in. The ball was deep enough that Gorkys Hernandez didn't have a realistic chance to get Rojas at the plate.
"In a situation like that, the biggest thing you can do as a hitter is realize the pressure is not on you, it's on the pitcher," Anderson said. "Just trying to stay within myself and get something in the strike zone I can elevate. Anything in the outfield. The last thing I want is a double play. Just trying to stay relaxed, trying to get something elevated and put something out in the outfield."
Justin Bour had two RBI hits, which pulled Miami even twice -- in the sixth and eighth innings. In a matchup against lefty Will Smith in the eighth inning, Bour's double drove home J.T. Realmuto, making it 4-4. San Francisco had gone ahead in the seventh on Evan Longoria's RBI single off Tayron Guerrero.
The Marlins celebrated their third walk-off, and first since May 1, when they edged the Phillies, 2-1. Miami seeks a four-game sweep with the series finale on Thursday at 12:10 p.m. ET.
For the third straight night, the Marlins came back after trailing early. They pulled even with two runs in the fourth inning on RBI singles from Cameron Maybin and Lewis Brinson off lefty Andrew Suarez, a rookie who attended the University of Miami. After trailing by a run again in the sixth inning, the Marlins pulled even on Bour's RBI single off Mark Melancon, scoring Realmuto from second.
Marlins lefty Caleb Smith has been effective keeping the ball in the park. He entered the night averaging 0.96 home runs per nine innings (seven total) in 65 2/3 innings. But in the first inning, Andrew McCutchen connected on a two-run home run. Statcast™ projected the drive to center at 422 feet with an exit speed of 103.7 mph.
"It was a great team win," Smith said. "They got ahead early. We were able to fight back, battle back and come out on top."
RELYING ON THE HEAT, ADDING A SPLIT Guerrero was bringing the heat in his 1 1/3 innings of relief, but the rookie is still struggling to mix in his slider. In the seventh inning, Longoria showed patience with the fastball, before slapping an RBI single to center on a pitch clocked at 100.6 mph.
In the at-bat, Longoria fouled off fastballs of 100.5 mph and 98.6 mph, before staying on a fastball that was located down and away. The pitch was on the corner, but it was elevated enough for Longoria to swat it into center field, scoring Buster Posey, which put the Giants up, 4-3.
Guerrero has been tinkering with a split fastball, a pitch he is easing in since the start of the season. It's still a work in progress.
Guerrero is a big part of the Marlins' future, and with his power arm, he has the makings to handle high-leverage, late-inning situations. But he became too reliant on his four-seam fastball in his 1 1/3-innings outing. Of the 37 pitches the rookie threw, 27 were four-seam fastballs. He mixed in five sliders. His fastest pitch of the night was 101.6 mph.
"He's working," Mattingly said. "He threw some sliders tonight, and threw some splits. We can only go so far with the split. We really like it, but it's a new pitch for him. We're working on it. He's got to be careful with how much he's using it. He's been fine. I think, he's another guy that we have to look at where he's come from, from last year until now. He's had a couple of rough spots, but he's had a lot of good spots. He's quick to the plate now. He's holding runners. He's throwing strikes, for the most part. He's coming along."
SOUND SMART The roof at Marlins Park on Wednesday was open for the 15th time this season, the most in a single season since the retractable roof building opened in 2012.
YOU GOTTA SEE THIS Bour went all out and nearly tumbled into the stands to make a catch on McCutchen's pop foul to end the fifth inning. With Joe Panik on first, McCutchen lifted a towering foul ball, and Bour went to the wall, extended into foul grounds and displayed the ball in his glove for the third out.
"J.B. made a good play and my defense was there for me," Smith said.
HE SAID IT "I think what's happened in this series is we've been able to keep it in range. We haven't gotten ourselves out of games. Our guys have come in, and even if there are people out there, we've been able to limit damage to give us a chance where we can get a big hit and get back into the game." -- Mattingly, on the team scrapping for three straight comeback wins
UP NEXT Dan Straily, who once played for the A's, is no stranger to facing the Giants. The Marlins' right-hander is 4-0 with a 2.43 ERA against San Francisco in his career. Straily takes the mound on Thursday at 12:10 p.m. ET in the series finale. Giants rookie Dereck Rodriguez, son of Hall of Famer Ivan "Pudge" Rodriguez, gets the nod.