SAN FRANCISCO (AP) — Manny Machado hit a tiebreaking double in the 10th inning and the San Diego Padres won in manager Bob Melvin’s return, holding off the San Francisco Giants 8-7 on Friday night.

Jake Cronenworth homered, Wil Myers doubled in two late runs and the Padres recovered after blowing leads of 4-1 and 6-4. Machado finished with three hits, raising his batting average to .359.

READ MORE: Anti-Black, Gay, Asian Bias Fuel California Hate Crime Surge

Darin Ruf homered twice for San Francisco. The Giants have lost four of six.

After the Giants tied the game on Wilmer Flores’ two-run single off Luis García with two outs in the ninth, Machado drove a slider on the outside of the plate from Camilo Doval (0-2) deep into center field to drive in Cronenworth, who began the 10th as the automatic runner at second base.

Two batters later, Jurickson Profar hit an RBI single that appeared to ricochet off Doval’s foot, scoring Machado.

Profar was booed throughout the game after getting into an exchange with fans in the third inning.

García (2-2) overcame his struggles in the ninth to win. Robert Suarez pitched the 10th for his first career save. He allowed Brandon Crawford’s RBI single with one out but retired the next two batters to end it.

Melvin returned to the Padres less than two weeks after undergoing prostate surgery May 11.

“It went well, that’s what I can share with you,” Melvin said before the game. “I’m glad I’m back. It’s miserable being away. One (game) gives you a little perspective, which is actually kind of good. Any more than that’s miserable. Just glad I’m back.”

Ruf hit a two-run homer off Sean Manaea in the third and added a solo drive in the fifth. It was the second multi-homer game of Ruf’s career and first with the Giants.

READ MORE: Squirrel, Tree Branch That Tripped Safety System Caused Power Outage In Grass Valley

PROFAR, FANS CAUSE DELAY

The game was delayed briefly after Profar got into it with fans before the start of the third inning. Profar was warming up and faked as if he was going to throw a ball into the outfield stands, then turned and tossed it into the stands along the third base line. Someone threw the ball back onto the field. At the same time another another ball was thrown onto the field, prompting crew chief Ted Barrett to walk over as Profar pointed into the stands. After a few moments, Barrett retrieved one ball and Profar grabbed the other as fans booed before play resumed.

FOR STARTERS

Manaea remained winless since April 18. The left-hander allowed four runs in six innings. It’s the first time in nine career starts against the Giants that Manaea has given up more than two earned runs.

San Francisco starter Jakob Junis, whose only win this season came in relief, allowed four runs and seven hits in six innings.

TRAINER’S ROOM

Padres: LHP Tim Hill was activated off the 10-day injured list after missing 13 games with left shoulder inflammation. RHP Steven Wilson was optioned to Triple-A El Paso.

Giants: OF LaMonte Wade Jr. was placed on the 10-day IL because of left knee inflammation. OF Luis González was called up from Triple-A Sacramento.

UP NEXT

MORE NEWS: HHS Secretary Xavier Becerra Pledges To Protect Access To Reproductive Health Care

Padres RHP Joe Musgrove (4-0, 2.20 ERA) has allowed two earned runs or fewer in all seven starts this season. Giants LHP Carlos Rodón (4-2, 3.49) is coming off his worst outing of the season — he gave up eight earned runs in 3 2/3 innings against the Cardinals.