PHOENIX -- Tim Locastro has been hit by pitches 12 times in 102 plate appearances this season. Avoiding it with the bases loaded on Sunday still worked in his favor.
Locastro's single in the 10th inning gave the Arizona Diamondbacks a 3-2 win over the San Francisco Giants, a line drive to left field that scored Nick Ahmed and helped the Diamondbacks end a season-long six-game losing streak.
The first pitch of Locastro's at-bat in the 10th against Giants reliever Mark Melancon almost hit him. Locastro turned out of the way.
"We would have won either way but I wanted to get a hit there," Locastro said. "I wasn't exactly trying to get away but it happened to miss me."
Melancon (3-2) uncorked a wild pitch to put runners at second and third with one out, and Carson Kelly was intentionally walked to bring up Locastro.
"Actually with that pitch not hitting me, I sort of knew his approach was to come in a little bit," Locastro said, "so I was looking in there and I was able to fight it over the third baseman's head and drop it in for a single."
Matt Andriese (4-4) pitched a scoreless top of the 10th to earn the win. He was the last of four relievers that held the Giants hitless for four innings.
"I have come in here for five straight days talking about losing a baseball game, and that's hard," Diamondbacks manager Torey Lovullo said afterward. "It's hard for me. It's hard for the team. It's hard for everybody, but we've got to find a way to keep grinding to have these (winning) moments happen."
Christian Walker had three hits for Arizona, extending his hitting streak to a career high eight games.
Kevin Pillar homered for the Giants, his 10th of the season, but San Francisco was held to four hits for the game.
"We just couldn't get anything going with the bats," Giants manager Bruce Bochy said. "They got the big hit, we didn't. That's the difference in the game."
Locastro rolled a single into shallow right field, the Diamondbacks' first hit of the game, driving in Caleb Joseph with two outs in the third inning. The Giants tied the score at 1 on Stephen Vogt's ground out to score Evan Longoria from third base in the top of the fourth.
Arizona went back in front 2-1 with Walker's RBI single in the fourth, the result of a nine-pitch at-bat that drove in Adam Jones, who'd reached on a wild pitch third strike.
Pillar led off the seventh inning with a solo shot to left field, which spelled the end of Diamondbacks starter Merrill Kelly's day. Kelly went six innings and allowed two runs on four hits, striking out nine.
The Diamondbacks opened their half of the seventh with back-to-back hits off Giants starter Shaun Anderson to put runners on second and third, and the Giants turned to Reyes Moronta in relief. Moronta worked out of the jam without allowing a hit.
Anderson allowed two runs on five hits in six innings.
"I just stayed with the same game plan. I attacked them early and got some quick outs," Anderson said. "Our bullpen has been absolutely dominant all year. I don't think they get enough credit for what they do."
The Diamondbacks were primed to take the lead in the seventh with Ahmed up to bat and runners in scoring position with no outs. Moronta threw a pitch to the backstop, but the carom arrived cleanly to catcher Vogt's glove, and Vogt had plenty of time to tag out Eduardo Escobar trying to score from third base.
The Diamondbacks failed to score in the inning.
Giants: Vogt took a foul ball of his right knee in the bottom of the fifth inning and was limping badly for a few moments immediately afterward, but remained in the game. After the game his knee was heavily wrapped. "I'm sure he's going to be sore tomorrow," Bochy said of Vogt.
Diamondbacks: 2B-OF Ketel Marte was held out of the lineup for a second straight day due to a minor groin injury from Friday's game.
Diamondbacks: RHP Zack Greinke (8-3, 2.91) is tabbed for the opener of a three-game series against the Los Angeles Dodgers starting Monday. He could face the Dodgers' Clayton Kershaw, a former teammate and fellow Cy Young Award winner, for the second time in his career.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Fiers doesn't want to talk about the past
Athletics pitcher Mike Fiers tells reporters that he's not talking about his role as a whistleblower and is hoping to move forward.
Source: Ryan Zimmerman agrees to 1-year deal with Nationals
Ryan Zimmerman, the first draft pick of the Washington Nationals after the team relocated from Montreal, has agreed on a one-year contract to remain with the team, as first reported by The Washington Post.
Sources: Rockies, Trevor Story agree to 2-year, $27.5M deal
The deal buys out the final two years of arbitration for Trevor Story, who will reach free agency at 29 in 2021-22.
Athletics' Mike Fiers declines to discuss whistleblower role
A's pitcher Mike Fiers said he didn't want his role as a whistleblower to be a distraction to his team, reiterating several times that he's "moving forward" and would not to discuss the sign-stealing scandal.
Royals' Salvador Perez becomes U.S. citizen at team's fan event
Royals catcher Salvador Perez took his oath of citizenship on Friday during the team's annual FanFest, the completion of a five-year process that he described as long and difficult but well worth it.
New manager Luis Rojas promises Mets success
Luis Rojas, who just 11 days earlier was prepping for spring training as a relatively anonymous quality control coach, said Friday at his introductory news conference that he will lead the Mets to success.