PHOENIX (AP) - Evan Longoria's solo home run in the eighth inning led the San Francisco Giants to a 3-2 win over the Arizona Diamondbacks on Sunday.

Longoria drilled Diamondbacks reliever Archie Bradley's 2-2 fastball with one out into the outcropping of seats in left-center field to break a tie. It was Longoria's 12th home run of the season.

The Diamondbacks' loss and the Los Angeles Dodgers' win Sunday created a tie for first place atop the NL West between the two teams.

Bradley (3-3) entered the game leading the NL in holds with 30. He had not allowed a run to the Giants in 12 straight games against them.

Right-hander Ray Black (1-0) earned his first career major league win with a scoreless seventh inning. The Diamondbacks loaded the bases in the bottom of the eighth with two outs against Giants relievers Tony Watson and Sam Dyson, but Dyson got Ketel Marte to fly out to end the inning.

Will Smith retired the Diamondbacks in order with two strikeouts in the ninth for his seventh save.

Giants All-Star catcher Buster Posey returned to the lineup after missing Saturday's game for concussion testing. Posey played first base and reached base twice.

Both starters lasted 5 1/3 innings in no-decision efforts. The Giants' Derek Holland allowed two runs on three hits and struck out six with two walks. The Diamondbacks' Robbie Ray walked four and struck out eight, giving up two runs on seven hits.

Steven Souza Jr.'s third home run of the season sailed into the left field seats and gave Arizona a 1-0 lead in the second inning. But the Giants tied the game in the third.

Longoria beat the defensive shift with a two-out single to drive in Andrew McCutchen, who has reached base in eight of his last nine plate appearances.

Marte bounced a single to right field to drive in Eduardo Escobar from second base for a 2-1 Diamondbacks lead in the fourth.

The Giants had a chance for a big inning in the sixth. Longoria led off with a double and scored on Nick Hundley's single, but Hundley was thrown out by left fielder David Peralta trying to reach second base on the hit. Austin Slater followed with a single and reached third base before the inning ended with Yoshihisa Hirano striking out Gorkys Hernandez.

TRAINER'S ROOM

Giants: Posey, who left Friday's game in the third inning after he took a foul ball to his mask, could catch in Monday's game if he continues to feel OK, manager Bruce Bochy said.

Diamondbacks: IF Deven Marrero (strained oblique) played nine innings of a rehab assignment game with Triple-A Reno and was scheduled to play again Sunday. ... OF Jarrod Dyson (groin strain) is hitting and throwing, but not doing serious running yet.

UP NEXT

Giants: RHP Dereck Rodriguez (5-1) is scheduled to pitch the opener of a two-game series against the Houston Astros Monday in San Francisco.

Diamondbacks: RHP Zack Godley (12-6) pitches the series opener against the Philadelphia Phillies Monday at Chase Field.