Yastrzemski scored the go-ahead run on Ryne Stanek's wild pitch in the eighth inning, Johnny Cueto pitched five scoreless innings in his second game back from Tommy John surgery and the Giants beat the Miami Marlins 2-1 Sunday.
Giants rookie Mauricio Dubon homered, and San Francisco took two of three from the struggling Marlins.
The grandson of Hall of Famer and Red Sox great Carl Yastrzemski, who was languishing in Baltimore's minor league system at the start of spring training, Yastrzemski has emerged as a building block player for the Giants, who open a three-game series in Fenway Park on Tuesday.
"It's special in the sense of the history of the game with my grandfather there. It's going to be pretty emotional and I'm going to try to contain those things, try to make it feel like it's any other game," Yastrzemski said.
"I've gotten to play against the Red Sox in spring training and they gave me a nice, warm welcome, so I'm not expecting anything, but I assume it'll be something like that."
Yastrzemski scored the go-ahead run on Stanek's second wild pitch. Yastrzemski and Brandon Belt reached on consecutive one-out singles against Jarlin Garcia (3-2). Both runners advanced on Stanek's first wild pitch before he walked Evan Longoria to load the bases.
The 29-year-old Yastrzemski is batting .265 with 19 homers and 65 RBI.
"He's got some of those qualities you like that may not show up on the spreadsheet, but he's good and he brings it every day," manager Bruce Bochy said.
Dubon homered leading off the third against starter Elieser Hernandez to break a scoreless tie. The 25-year-old rookie connected on a 1-0 slider that just cleared wall in left for his third homer.
Cueto gave up three hits, struck out two and walked two. The two-time All-Star has combined for 10 innings of four-hit ball in his two starts since coming off the injured list.
"I'm happy with the way things are going," Cueto said. "I feel healthy and I just want to continue working on what I need to work on for next year."
Giants reliever Tyler Rogers (2-0) struck out one in a 1-2-3 eighth for the win, and Will Smith worked around a walk and a wild pitch in the ninth for his 33rd save in 37 tries. The All-Star closer had been out since Sept. 6 with back tightness.
Jon Berti had two hits and one RBI and made a great defensive play for the Marlins, who have lost six of seven and are 11-34 since July 30.
Hernandez struck out a career-high nine in five innings of three-hit ball. He gave up one run and walked one.
"He got pretty good counts and was aggressive," Marlins manager Don Mattingly said. "I thought his stuff looked good today. He kind of shows you who he is and he's going to give you velocity as far as what you see, but the thing about him is that is that he was a Rule 5 guy last year and to this year, he's come a long, long way. And he's still a young kid."
The Marlins tied the game in the seventh on Berti's two-out, RBI single, which scored Magneuris Sierra from third. Sierra reached on a two-out infield hit and went to third on Longoria's throwing error from third.
Giants first baseman Belt bunted down the third base line against the shift for a hit leading off the sixth.
Berti made a leaping catch in left field, crashing into the top of the wall to rob Longoria of extra bases in the bottom of the first.
Marlins: RHP Jordan Yamamoto (right forearm strain) will pitch in an instructional league game on Monday and could join the rotation before the end of the season, manager Don Mattingly said.
Giants: OF Alex Dickerson (right oblique) appeared in Sunday's game as a pinch hitter and struck out in his only at-bat the fifth. Dickerson hadn't played since Sept. 3. ... Center fielder Kevin Pillar got an off day. . RHP Enderson Franco was selected from Triple-A Sacramento. . LHP Tony Watson (left wrist fracture) was placed on the 60-day injured list.
Marlins: RHP Pablo Lopez (5-8, 4.97 ERA) will open Monday's series opener against the Diamondbacks in Arizona.
Giants: RHP Logan Webb (1-2, 6.75 ERA) will make his sixth career start in Tuesday's series opener in Boston.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Cubs helps out with gender reveal
Chicago Cubs' infielder David Bote helps out with a gender reveal for two Cubs fans.
Anthony Rendon goes 2-for-2 in Angels debut
Third baseman Anthony Rendon went 2-for-2 in his spring training debut with the Los Angeles Angels, driving in a run and scoring one Tuesday in a 7-3 win over Cincinnati.
Scott Boras to honor Kobe's wish, grant internship
Baseball superagent Scott Boras told the Los Angeles Times that he will create an internship for the teenage daughter of John Altobelli, the baseball coach killed in last month's helicopter crash.
Tebow cranks HR to the opposite field
Tim Tebow crushes a pitch to the opposite field for his first home run of spring training.
Cashman: Severino planning to have Tommy John as soon as possible
Yankees GM Brian Cashman acknowledges that Tommy John surgery is necessary for Luis Severino.
Yankees starter Luis Severino needs Tommy John surgery
Yankees starter Luis Severino needs Tommy John surgery, according to general manager Brian Cashman.