PHOENIX -- On his fourth trip to the majors this season, Dereck Rodriguez looked like a pitcher who plans to stay.
Rodriguez pitched seven innings of three-hit ball after being recalled from Triple-A Sacramento earlier Thursday, Evan Longoria had a 412-foot homer among his three hits and four RBI, and the San Francisco Giants beat the Arizona Diamondbacks 7-0.
"(Rodriguez) came out very determined to show that this is where he belongs and hopefully this is what he can build on," San Francisco manager Bruce Bochy said.
"It's been an up-and-down year for him, going back and forth. He showed tonight what he can do, and we needed it. We've had some struggles in the rotation, and that was a real shot in the arm for us."
Rodriguez (5-6) mixed four pitches effectively and was in complete control, retiring the first 11 batters he faced before Eduardo Escobar lined a single to right field with two outs in the fourth inning.
Rodriguez didn't allow an extra-base hit, struck out four and walked one while matching his longest start in a season in which he has yo-yoed between Triple A and the majors.
"I just wanted to attack, go after them," said Rodriguez, who threw 61 strikes in 95 pitches. "I know we're close to them in the wild card, and we have a playoff atmosphere. It was a lot of fun."
Longoria had a two-run single off Alex Young (4-3) in the first inning and hit a two-run homer off Young to cap a three-run fifth as the Giants (61-61) pulled even with Arizona as both teams chase an NL wild-card spot.
Longoria is hitting .350 in 10 games after missing the previous 19 with plantar fasciitis. He has five homers and 15 RBI in 15 career games at Chase Field.
Austin Slater had three hits, scored twice, drove in a run and reached base all five times for the Giants, who have won four of five. He also made two stellar catches in the first inning.
"It takes a lot of pressure off an offense, knowing that your pitcher is going to go out and give you seven innings and keep you in a ball game," Slater said. "Not enough can be said about that.
The Diamondbacks did not get a runner as far as second base and have lost two in a row after winning seven of 10.
"I feel like we got flattened in the first inning," Arizona manager Torey Lovullo said. "I don't want to take anything away from the game-planning that the Giants did, but we just didn't play up to our capabilities today."
Rookie left-hander Young gave up eight hits and five runs in five innings while losing his third straight. He beat the Giants 5-1 in his first career appearance June 27.
FIRST THINGS FIRST
Buster Posey's rolling single loaded the bases in the first, fueling a two-run inning when his slow grounder down the third base line bumped into the bag before it could turn foul. Longoria followed with a two-run single.
Slater then dived to his right to take extra bases away from Josh Rojas before hurrying to his left to catch Escobar's hard liner in the bottom of the inning.
PILLAR OF STRENGTH
Giants center fielder Kevin Pillar has reached base in 15 of his last 17 games and is hitting .357 with six doubles, three homers and eight RBI in that stretch. He was intentionally walked in the third inning and hit by a pitch in the ninth.
Giants: RHP Johnny Cueto (Tommy John surgery) threw 49 pitches in 2 2/3 innings in his third rehab start at Class A San Jose on Thursday and is scheduled to throw 55-60 pitches in his next outing. "The way he is throwing, he will be pitching for us in September," Bochy said. . RHP Shaun Anderson (middle finger blister) threw a 35-pitch bullpen Thursday and is scheduled for another Saturday. He is eligible to return Monday. . OF Steven Duggar (left shoulder sprain) is to see Dr. Neal ElAttrache on Monday to determine a course of treatment.
Diamondbacks: LHP Robbie Ray (right lower back spasm) was placed on the injured list Thursday after being forced out of his Wednesday start in Denver while warming up before the third inning. . RHP Stefan Crichton and RHP Jon Duplantier were recalled from Triple-A Reno on Thursday. OF Tim Locastro was optioned to Reno.
Giants: RHP Jeff Samardzija (9-9, 3.55) has given up three runs in 24 innings in his last four starts. He has lost two of three starts against the Diamondbacks this season.
Diamondbacks: RHP Mike Leake (9-9) has given up 10 runs and 21 hits in 10 1/3 innings in his two starts since joining Arizona at the trade deadline. He has given up a major league-high 31 homers
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Clayton Kershaw reflects on NLDS loss, 'shocked' by Astros allegations
A more upbeat Clayton Kershaw says the team's NLDS loss to the Nationals still stings, but he won't let it affect his preparation for next season.
Josh Donaldson surprises his mom with a new car
Josh Donaldson gifts his mom a new Maserati because she quit smoking.
Source: Cubs, reliever Brandon Morrow agree to minor league deal
The Cubs and Brandon Morrow have agreed to a minor league deal that will bring the oft-injured reliever who hasn't pitched since the first half of 2018 back to Chicago, a source told ESPN.
Injured Yoenis Cespedes agrees to pay cut in grievance settlement
Yoenis Cespedes' salary for 2019 was cut in half and his pay for 2020 significantly reduced as part of a settlement of a grievance between the injured outfielder and the New York Mets.
Veteran LHP Brett Anderson signs 1-year deal with Brewers
The Brewers have added veteran LHP Brett Anderson to their pitching staff. The 31-year-old left-hander was 13-9 with a 3.89 ERA in 31 starts with the Athletics last season.
Source: Rays agree to two-year, $12M deal with OF Yoshitomo Tsutsugo
The Tampa Bay Rays have agreed to a two-year, $12 million contract with Japanese position player Yoshitomo Tsutsugo, a source confirmed to ESPN's Jeff Passan.