SAN FRANCISCO -- When the Marlins intentionally walked Brandon Crawford to bring up pitcher Jeff Samardzija in the No. 8 hole, Giants manager Bruce Bochy second-guessed whether this might have been a night to bat his starter in the typical ninth slot.
Samardzija delivered his best performance at the plate while pitching San Francisco to a much-needed victory.
He struck out five over 7 2/3 innings and drove in a career-high three runs with a double to win in a memorable home debut, and the Giants snapped a five-game losing streak by beating Miami hitting coach Barry Bonds and the Marlins 8-1 on Friday night in the slugger's return to AT&T Park.
"It was great to come out here and throw well the first time out here in this stadium. It was an electric atmosphere," Samardzija said. "It's a very educated fan base with high standards, so you want to live up to those standards. When you come play at a park like this with the history they have here, as a new guy, you want to prove your worth and prove that you belong on this team. Hopefully they saw some things they like."
Samardzija (2-1), who signed a $90 million, five-year contract, left to a standing ovation when he walked off in the eighth. He allowed one run and six hits and didn't walk a batter in the 117-pitch gem.
Brandon Belt, Angel Pagan and Denard Span had RBI singles, while Matt Duffy had a sacrifice fly and Crawford drove in a run on a groundout for the Giants, who had gone 3 for 35 with runners in scoring position during their skid.
The timely hits sure turned up this time after a discouraging four-game sweep by the division rival Arizona Diamondbacks.
Even from Samardzija, who hit a two-run double in the sixth and RBI single in the fifth -- earning some praise from Belt and a comparison to the top hitting pitcher on the team, ace Madison Bumgarner.
"He might rival Bum when it comes to power," Belt said.
Samardzija shrugged it off.
"You get lucky every so often up there as a pitcher," Samardzija said. "Close your eyes, swing hard and you might hit it."
The big right-hander had three RBI in a season twice -- 2012 and `14 -- and had driven in 10 total runs before Friday.
Bonds returned to the ballpark he helped get built wearing a Marlins uniform. He brought the lineup card out before first pitch to chants of "Barry! Barry!" -- clearly still appreciated even after allegations he used performance-enhancing drugs.
His hitters didn't make him look very good against his former team.
Marlins starter Jarred Cosart (0-1) walked six batters over 4 1/3 innings for his second straight start allowing six free passes. He has 15 walks over 14 2/3 innings in his initial three starts. Cosart allowed six runs and eight hits.
Miami manager Don Mattingly was ejected in the top of the fourth, then came out to fume at plate umpire Brian Gorman for a couple of minutes. Mattingly said afterward he was standing up for his players because the Marlins aren't getting the calls he feels they deserve.
"Just a little frustrated as much as anything," he said. "I almost think it's like any kind of close call or big situation, there's never a call that goes the Marlins' way."
In the middle of the third, Bonds' highlights -- home runs, of course -- played on the video board and he was shown in the Miami dugout. He blew kisses, waved and tipped his cap to a standing ovation from the sellout crowd of 41,760 before coming up the steps to show his appreciation.
When asked before the game about a reception, Bonds said: "I think a good one, because this is where I played, this is my home. I would hope that this city has great memories."
The 51-year-old Bonds played the final 15 of his 22 major league seasons for the Giants, breaking Hank Aaron's home run record in his final season of 2007 and finishing with 762 career homers.
Marlins: INF Martin Prado returned to Miami to be with his wife for the birth of their child. ... Giancarlo Stanton and Dee Gordon returned to the starting lineup after what Mattingly called a "mental blow" to get a break.
Giants: INF Conor Gillaspie's contract was purchased from Triple-A Sacramento and INF Mac Williamson was optioned to Sacramento. To clear roster room for Gillaspie, INF Ehire Adrianza (fractured left foot) was transferred from the 15-day to the 60-day DL.
Marlins: RHP Jose Fernandez (1-1) won last July 2 in his only other start against San Francisco.
Giants: RHP Jake Peavy (0-1) tries again for his first victory of the season. He is 5-4 with a 2.83 ERA in nine starts against the Marlins.
Milwaukee Brewers' Lorenzo Cain placed on 10-day IL; Christian Yelich continues to deal with back tightness
Brewers outfielder Lorenzo Cain has been placed on the 10-day injured list with a strained left quad and Christian Yelich is out for the third straight game with back tightness.
Fantasy baseball: Ramon Laureano stealing the spotlight
Eric Karabell takes a look at the fantasy impact from some of the top news around the league, including Oakland's unexpected source of speed on the basepaths, as well as other stolen base options.
Bernie Madoff, whose Ponzi scheme affected New York Mets, dies at 82
Bernie Madoff, whose Ponzi scheme defrauded thousands and affected the finances of the New York Mets, has died in prison.
Fantasy baseball: A pair of Angels pitchers on the rise
Every Wednesday, Tristan H. Cockcroft identifies players who should be added to fantasy baseball rosters -- and those who are safe to drop in order to make room for them.
'From Forgotten to Forever: Jackie Robinson's historic handshake'
A photo of Robinson shaking hands with minor league teammate George Shuba is being immortalized in bronze. (Voiceover: Clinton Yates)
Fantasy baseball forecaster: Team hitting ratings
Stay ahead of the game and optimize your fantasy baseball hitters with our forecaster, which provides a rolling 10-day outlook of every team's hitting matchups as well as the potential for stolen bases.