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.
Why the Giants are Mendoza's surprise team
Jessica Mendoza praises the San Francisco Giants' starting pitching and offense from their older players as reasons for their hot start.
Freeman sits; Braves complete 1st sweep of Nats since 2014
— Ehire Adrianza made the most of a rare start on a day off for slumping NL MVP Freddie Freeman, providing a nice defensive play and a two-run single to back Drew Smyly's strong...
Grichuk drives in 5, Jays beat A's 10-4 for series split
— Randal Grichuk homered, doubled and drove in five runs to lead the Toronto Blue Jays to a 10-4 victory over the Oakland Athletics on Thursday.
Lester accidentally trucks Albies as Ozuna scores
Ehire Adrianza cranks a line-drive single to center field, driving in Ozzie Albies, who accidentally gets decked by Nationals pitcher Jon Lester while encouraging Marcell Ozuna to score.
Gallo locks up Rangers' win with a sliding catch in extras
Miguel Sano hits a fly ball that looks like it has a chance to drop and tie the game, but Joey Gallo charges in and makes a sliding catch.
Red Sox complete comeback, win series vs. Tigers
The Red Sox offense lights up Tigers for 12 runs as Boston takes down Detroit and wins the series.