PHOENIX -- Evan Longoria hit two doubles, Brandon Belt reached base four times and the San Francisco Giants snapped a three-game losing streak by beating the Arizona Diamondbacks 5-2 on Saturday night.
San Francisco starter Trevor Cahill retired his first eight batters but left the game abruptly in the fourth inning with left hip discomfort. The move came a few pitches after he gave up a two-run homer to Christian Walker that pulled the D-backs within 4-2.
The Giants leaned on an outstanding bullpen effort the rest of the way. Jarlin Garcia (2-1), Sam Coonrod, Trevor Gott, Tony Watson and Tyler Rogers combined for 5 2/3 scoreless innings and gave up just one hit. Rogers earned his second save.
"We know we're going to have to play good ball to be a playoff team," Cahill said. "I think we're up for the challenge. We've been on an exciting run the last couple weeks."
Cahill's injury issue appeared to start in the third inning with the pitcher grimacing as he walked around the mound. Manager Gabe Kapler and a trainer came out to check on him but he remained in the game until the fourth.
The veteran right-hander gave up two runs over 3 1/3 innings. He struck out four and walked two.
"It's something that's always there, it's just never gotten to a point where I felt like it's actually affected me pitching," Cahill said. "Today was the day. I just got sore to the point where I just couldn't go anymore."
San Francisco jumped ahead 2-0 in the first after Longoria and Belt hit back-to-back RBI doubles. The Giants added another run in the third when Mike Yastrzemski's double brought home Mauricio Dubon and pushed ahead 4-0 in the third when Pablo Sandoval's single scored Longoria.
Wilmer Flores hit a solo homer in the ninth to put the Giants up 5-2.
"I thought we did a nice job on offense tonight," Kapler said. "We really haven't been able to kind of throw the right hook and land a knockout blow and I do think that that's something that we're going to have to be able to do to be the kind of team that we want to be."
It was a disappointing outing for Arizona's Luke Weaver (1-5), whose ERA ballooned to 8.23. The right-hander was coming off two consecutive encouraging starts but regressed against the Giants, giving up four earned runs on eight hits and a walk in just three innings. He struck out six.
"I think Luke had good stuff, but there were just too many middle (of the plate) mistakes," Arizona manager Torey Lovullo said. "When you make middle mistakes at this level, you're going to pay for them."
Arizona has lost nine of its past 10 games. The D-backs managed just three hits and are the second team in the National League to lose 20 games this season, joining the Pittsburgh Pirates.
On paper, Arizona's offense has several accomplished offensive players like Kole Calhoun, Ketel Marte, Starling Marte, David Peralta and Walker, but it hasn't translated to results. The D-backs expected to compete for a spot in the playoffs this season but they're running out of time to make a move.
"It's been fairly inconsistent, I know that," Lovullo said. "We're all aware, it's something we're working on every single day."
Cahill has started on the mound for eight different MLB teams: Oakland, Arizona, Atlanta, San Francisco, San Diego, Kansas City, the Los Angeles Angels and the Chicago Cubs. That's the most for an active pitcher.
The all-time record is 12 teams by Mike Morgan, who played 22 seasons in the big leagues from 1978 to 2002.
Diamondbacks: Lovullo said that LHP Madison Bumgarner (back) was scheduled to throw a bullpen on Saturday night.
Giants: San Francisco sends RHP Johnny Cueto (2-0, 5.40) to the mound for Sunday's series finale.
Diamondbacks: Arizona counters with RHP Taylor Clarke (1-0, 2.33), who makes his second start of the season.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Cincinnati Reds GM Nick Krall to run team's baseball operations
Reds vice president and general manager Nick Krall will run the franchise's baseball operations department, assuming the role previously held by Dick Williams.
Los Angeles Dodgers favored over Tampa Bay Rays to win World Series
The Dodgers are favored by Las Vegas to beat the Rays and win the World Series.
Why Mendoza is picking the Dodgers in the World Series
Jessica Mendoza contends that the Dodgers' offense is what will carry them to winning the World Series over the Rays.
World Series 2020: Cody Bellinger's October heroics started with a text from his dad
The Dodgers' former MVP got some advice from his father before hitting his huge Game 7 homer. Is there more where that came from?
World Series 2020: Ultimate Los Angeles Dodgers-Tampa Bay Rays viewers guide
Players to watch, key matchups, strategic decisions and more -- here's your guide to a Fall Classic like no other.
World Series 2020: Schedules, postseason bracket, analysis and updates
All the latest information about the expanded baseball postseason.