SAN FRANCISCO (AP) — Joc Pederson scored from first base on Mike Yastrzemski’s one-out double in the eighth inning, sending the San Francisco Giants to a 5-4 win over the New York Mets on Sunday.

Activated off the injured list before the game, Pederson drove in the Giants’ first run with a single in the first and then started the winning rally with a walk against Drew Smith (1-1).

Yastrzemski followed with a line drive into right-center, and a sliding Pederson beat the relay to the plate.

Thairo Estrada hit his fourth home run for the Giants. San Francisco, which entered with the third-lowest winning percentage in the National League, won its second straight against New York to split the four-game series.

Touted rookie Francisco Álvarez hit his second major league home run and first this year, which marked the first extra-base hit by a Mets catcher this season.

Scott Alexander (2-0) worked a perfect eighth and Camilo Doval struck out his first two batters in a 1-2-3 ninth for his second save.

The Giants led 4-3 following rookie Brett Wisely’s first career RBI in the fourth, a one-out grounder against New York starter Tylor Megill.

Megill, winless in his last two starts after beginning the season 3-0, allowed four runs and six hits in four innings.

Álvarez’s home run off Tyler Rogers with two outs in the sixth tied it at 4.

New York scored twice in the fourth on consecutive sacrifice flies. Giants right fielder Michael Conforto dropped the first one for an error, sending Daniel Vogelbach to third base. He came home on Brandon Nimmo’s sac fly.

Ross Stripling was uneven in his return to San Francisco’s rotation after making three appearances out of the bullpen. The right-hander, signed as a free agent in the offseason, lasted 3 1/3 innings and allowed three runs and six hits.

Francisco Lindor had an RBI double for the Mets in the third.

TRAINER’S ROOM

Mets: RHP Justin Verlander (low grade teres major strain in his upper back) threw 43 pitches over three innings of live batting practice with good results, manager Buck Showalter said. Verlander is scheduled to make a minor league rehab start Friday. … C Omar Narváez (left calf strain) is making slow progress and has been squatting and catching balls off a machine in recent days.

Giants: Pederson was reinstated from the 10-day IL after missing nine games with right wrist inflammation. OF Heliot Ramos was optioned to Triple-A Sacramento to make room.

UP NEXT

Mets: Following an off day Monday, New York opens a seven-game homestand against the Nationals and Braves. Showalter had not announced a starter for Tuesday night.

Giants: RHP Alex Cobb (0-1, 2.79 ERA) starts the opener of a four-game home series with St. Louis on Monday. Cobb has made it past the fifth inning just once in four starts this season.