SAN FRANCISCO (AP) - Jeff Samardzija spent extra time watching video, and it paid off.
He pitched eight stellar innings of two-hit ball, Evan Longoria and Kevin Pillar each homered, and the San Francisco Giants beat the Philadelphia Phillies 3-1 on Saturday.
Samardzija (9-9) gave up one run, struck out five and walked none. He retired 20 straight after giving up a solo homer to Corey Dickerson with two outs in the top of the first inning. Samardzija's streak ended with César Hernández's one-out single in the eighth.
Samardzija was facing the Phillies for the second time in less than two weeks. He pitched six shutout innings of three-hit ball in a 5-1 win at Citizens Bank Park on July 31.
"I went back and watched the film and just saw a couple of spots where we could improve on, and ultimately do a little bit different there so we're not doing exactly the same stuff," Samardzija said.
"A very dangerous lineup, so really you can't really let off the gas and I didn't do that today."
The 34-year-old right-hander is 5-2 with a 1.95 ERA in eight starts since July 1. He's 2-0 with a 1.13 ERA and 19 strikeouts over his last four starts.
"They just saw him and he threw another beauty," Giants manager Bruce Bochy said.
"He's in a really good place as far as commanding the ball, all four pitches . That was just a great job of executing your pitches for eight innings."
Vince Velasquez (4-7) gave up three runs in five innings of three-hit ball. He struck out three and walked one.
Pillar homered leading off the fifth off Velasquez to give San Francisco a 3-1 lead. Pillar golfed an 0-2 slider below his knees for his 15th homer and career-high 60th RBI.
The Giants took a 2-1 lead on Longoria's two run homer to left off Velasquez in the second. His 14th homer came on a hanging slider.
Longoria's homer was his first since July 12. The three-time All-Star missed 19 games with left foot plantar fasciitis.
"It really did a lot for the club because first inning, we looked a little flat there, but we woke up because of Longo," Bochy said.
Dickerson's seventh home run was Samardzija's only mistake on the day - a 90-mph fastball he left over the middle of the plate. It was his third homer since coming over from the Pirates in a July 31 trade.
"He has a fastball-cutter combination," Phillies manager Gabe Kapler said of Samardzija. "It's difficult to pick up which is which, and he does a really good job of changing eye levels."
Will Smith worked around a hit and walk in the ninth to notch his 28th save in 30 tries. The Giants closer struck out Dickerson swinging with the tying runs on base.
Phladelphia lost for the fourth time in five games.
Leadoff man Bryce Harper is a career .136 hitter (3 for 22) against Samardzija after the 2015 NL MVP was hitless in three at-bats against the pitcher. Harper finished the day 0-for-4.
Giants: RHP Johnny Cueto (Tommy John surgery) pitched two innings for the Giants' Arizona Rookie League affiliate on Friday. The two-time All-Star threw about 20 pitches and hit 92 mph before throwing an additional 15 pitches in the bullpen, manager Bruce Bochy said. He's expected to throw 40 pitches in a rehab game with Single-A San Jose on Wednesday or Thursday, Bochy said. ... 2B Scooter Gennett stayed in the game after getting hit in the right forearm by a 91.8-mph two-seam fastball from Velasquez. ... OF Alex Dickerson (right oblique strain) will likely start a rehab assignment with Triple-A Sacramento on Tuesday, Bochy said.
Phillies: RHP Jake Arrieta (8-8, 4.41 ERA) will make his sixth start since revealing he has a bone spur on his pitching elbow that will likely require surgery. The 2015 NL Cy Young Award winner is 0-2 with a 4.34 ERA over his last six starts.
Giants: LHP Connor Menez (0-1, 5.73) will make his third career start.