SAN FRANCISCO (AP) — Juan Perez hit a tiebreaking single with two outs in the eighth inning and the San Francisco Giants beat San Diego 5-4 on Tuesday night, snapping the Padres' seven-game winning streak.
Perez's clutch swing came after pinch hitter Jesus Guzman gave San Diego a 4-3 lead with a two-run homer in the top half of the inning
Buster Posey started the San Francisco comeback with a leadoff single. After Hunter Pence struck out, Brandon Belt doubled in pinch runner Andres Torres. Nick Noonan was intentionally walked and Joaquin Arias lined out to center before Perez rolled a single just past second baseman Logan Forsythe for the go-ahead score.
Belt finished with three hits to help the Giants move into a second-place tie with Colorado in the NL West.
Jean Machi (2-0) retired one batter for the win and Sergio Romo worked the ninth for his 17th save.
The wild finish was in stark contrast to the first part of the game, when San Francisco ace Matt Cain and Andrew Cashner were locked in a pitchers' duel.
Cain had a season-high 10 strikeouts in seven innings and was charged with two runs and six hits. He retired 15 straight at one point.
Cashner scattered 10 hits over 6 2-3 innings and allowed three runs. He struck out six and walked one.
Perez, playing in just his seventh game since being called up from the minors, also made a key play in the seventh when he threw out Mark Kotsay at home plate after Kotsay had doubled leading off the inning. It was the fourth assist for the young center fielder.
Marco Scutaro had two hits in his return to San Francisco's lineup. Gregor Blanco and Posey also had two hits apiece.
Nick Hundley and Logan Forsythe homered for San Diego. The Padres entered with an NL-leading 17 come-from-behind wins and were in position to add to that total before the Giants rallied.
San Francisco beat Cashner in his first start of the season and jumped on him early in this one.
Blanco drew a leadoff walk, stole second and took third on Scutaro's comebacker. Posey then blooped a single into short right to drive in Blanco.
Belt and Noonan opened the fourth with back-to-back singles. Belt then scored on a double-play grounder to make it 2-0.
Cain was unable to hold onto the lead.
Coming off an impressive outing against Pittsburgh in his previous start, the right-hander retired 15 straight after allowing a single to Forsythe in the first. He was cruising until the sixth.
Hundley ended Cain's run with his fifth homer of the season, a towering shot to left that made it 2-1. One out later, Forsythe belted a drive to left-center.
San Francisco's defense provided a spark after Kotsay's hit in the seventh. Chris Denorfia followed with a single to center but Perez threw out a sliding Kotsay at home.
Blanco hit an RBI single off Cashner in the seventh but the Padres grabbed the lead on Guzman's second pinch-hit homer of the season.
NOTES: San Francisco SS Brandon Crawford left with two sprained fingers on his right hand after getting thrown out attempting to steal second in the second. ... Giants All-Star 3B Pablo Sandoval (left foot strain) is expected to begin a rehab assignment with Class-A San Jose on Friday. The reigning World Series MVP took batting practice and fielded grounders before the game. ... OF Angel Pagan ran the bases before the game and could begin a rehab assignment this week, according to San Francisco manager Bruce Bochy. Pagan has been on the disabled list with a strained left hamstring since May 28. ... The Padres signed OF Ben Francisco to a minor league contract and assigned him to Triple-A Tucson. ... San Diego OF Carlos Quentin (left shoulder) sat out his fourth straight game but is improving, manager Buddy Black said. ... Padres SS Everth Cabrera's left hamstring showed no signs of improvement so Black gave him another day off. ... LHP Eric Stults (6-5) pitches the series finale for San Diego and has a 2.26 ERA over his last nine starts. LHP Madison Bumgarner (6-4) will go after his team-leading seventh win for the Giants. ... San Francisco signed first-round draft pick Christian Arroyo. Arroyo, the 25th overall selection in the draft, batted .524 for Hernando High School in Brooksville, Fla.