PHOENIX — The Giants may not have the same type of star power as the Dodgers and Padres, but they do have a repeatable recipe for success that’s kept them in first place in the National League West for the last five weeks.

A well-rounded Giants roster will create matchup advantages, target an opponent’s weaknesses and exploit them and in Sunday’s series finale, that’s exactly what they did.

Diamondbacks left-hander Caleb Smith couldn’t solve the Giants’ right-handed platoon bats, Austin Slater and Darin Ruf, and Giants starter Anthony DeSclafani took advantage of a weak Arizona offense by pounding the strike zone while falling one out shy of his third complete game of the season in a 5-2, series-clinching victory.

The Giants may have won for the 17th time in their last 20 games against the Diamondbacks dating back to the start of the 2020 season, but the victory was marred by an injury to one of their most important players.

With pinch-hitter Daulton Varsho at the plate in the sixth inning, Posey took a foul ball off his glove hand that injured his left thumb. The Giants’ catcher initially tried to stay in the game, but after catching one more pitch from DeSclafani, he exited the field and was replaced by backup Curt Casali.

The Giants announced in the ninth inning that Posey was diagnosed with a left thumb contusion and a X-Ray was negative. The injury came in the midst of another strong performance for a player who was named to his seventh career All-Star team earlier this week. At the time he departed, Posey had contributed to a pair of Giants rallies with a RBI single, a walk and two runs while also guiding DeSclafani through six scoreless frames.

After launching a 463-foot go-ahead home run in the eighth inning of Saturday’s game, Slater made his first start in a week against Smith. The right-handed hitting outfielder jumpstarted the Giants’ first rally with a bloop single into right center field and put himself in scoring position by tagging up and swiping second base on a flyball to the left field warning track hit by Thairo Estrada.

When Buster Posey plopped a single in between D’backs shortstop Nick Ahmed and left fielder David Peralta, Slater scored to give the Giants a 1-0 lead.

In the third inning, Slater stepped in for the second time and delivered another tape measure blast that looked nearly identical to his game-saving homer on Saturday. The Smith changeup Slater crushed well beyond the left center field wall registered at 467 feet on Statcast, besting the previous mark for the longest home run hit by a Giants player this season Slater set on Saturday.

The homer also made Slater the first hitter in the majors this season with three home runs that traveled at least 460 feet as he also cleared that distance with a game-tying, two-run shot against the Diamondbacks at Chase Field on May 26.

The Giants’ other critical platoon hitter against lefties made his presence felt against Smith as Ruf drilled a two-out RBI double into the left center field gap in the first inning before sending a 439-foot, two-run home run off Smith in the sixth inning.

Ruf’s home run was made possible by a disciplined plate appearance from Posey, who worked a two-out walk against a laboring starter to set up the slugger for success.

A 5-0 lead was more than enough for DeSclafani, who became the 11th National League pitcher to top 100 innings this season with 8 2/3 innings of two-run ball. Of that group, DeSclafani joined Dodgers lefty Clayton Kershaw as the only other to reach nine wins as he’s been the winning pitcher in five of his last six starts.

Despite being left off the initial All-Star roster, DeSclafani still has a chance to represent the Giants at the Midsummer Classic as a replacement choice as his 2.80 ERA ranks 14th among qualified National League starters while his 1.00 WHIP is better than All-Stars such as Trevor Rogers of the Marlins and Germán Márquez of the Rockies.