SAN FRANCISCO -- Will Smith had to work around a pair of two-out hits and a seven-pitch walk in the ninth inning to keep his perfect season intact with another save.
Make it 16 for 16 for the Giants closer, who got Manuel Margot to pop up with the bases loaded for the final out of San Francisco's 4-2 win over the San Diego Padres on Wednesday night.
"It got a little scary there in the ninth," Giants manager Bruce Bochy said. "But Smitty made a pitch when he had to."
Smith has been doing that all season, although his save opportunities have been limited by San Francisco's struggles. The left-hander was in position for one Wednesday and quickly retired the first two batters in the ninth before running into trouble.
Ian Kinsler reached on an infield single that was initially ruled an error. Pinch-hitter Hunter Renfroe followed with a double and Smith walked pinch-hitter Wil Myers before retiring Margot to end it.
"I knew the offense had given us a two-run lead so if that guy on third scored, so what?" Smith said. "I wasn't really panicking. I was more worried about Renfroe than anything else. So when he hit that double, so what, who cares? Let's just try to get one more out."
Smith's 16 consecutive saves to start the season are the second-most for the Giants since saves became an official stat in 1969.
"Our bullpen is unbelievable," winning pitcher Shaun Anderson said. "The trust is awesome to have that back there."
Evan Longoria drove in the go-ahead run with an infield single in the fifth after the Padres made two errors.
Kevin Pillar homered for the first time in more than a month and Donovan Solano had two hits and two RBIs for the Giants. Buster Posey went 1 for 4 after coming off the injured list earlier in the day.
Anderson (2-1) pitched four-hit ball over six innings and had a season-high six strikeouts for San Francisco. The rookie has a 3.32 ERA in three June starts after going 0-1 with a 4.80 ERA in three May starts.
Eric Hosmer had an RBI double for the Padres, who committed three errors overall that led to three runs.
"Ninth inning, we put ourselves in a position to win," manager Andy Green said. "It just wasn't enough to get over the hump."
San Diego's defense came apart in the fifth.
Steven Duggar singled, went to second on a wild throw by shortstop Fernando Tatis Jr. and scored on Solano's single. As Solano rounded first, left fielder Josh Naylor made a wild throw toward second that sailed out of play for a two-base error. After Brandon Belt walked, Tatis made a diving stop on Longoria's sharp grounder but threw wide of second as Solano scored.
"I guess we did a little ground attack there and got some breaks," Bochy said. "It happened to us the night before. It was good to take advantage of it."
The Giants added another unearned run in the seventh following a throwing error by Padres reliever Robbie Erlin.
Sam Dyson and Tony Watson retired three batters apiece for San Francisco.
Padres starter Joey Lucchesi (5-4) allowed three runs, two earned, and five hits in six innings. Lucchesi, who beat the Giants on March 29, had six strikeouts and two walks.
A LITTLE SHORT
The Padres thought they had a home run in the first inning when Naylor hit a ball that bounced off the top of the fence in center and back onto the field. A crew chief review confirmed the call of a double. San Diego loaded the bases later in the inning but Anderson got Padres home run leader Franmil Reyes to ground into a 6-4-3 double play on the first pitch.
San Francisco optioned backup catcher Aramis Garcia to Triple-A Sacramento. San Diego optioned RHP Chris Paddack to Class A Lake Elsinore and called up RHP Robert Stock from Triple-A El Paso.
Giants: Posey missed eight games with a right hamstring injury sustained June 1 in Baltimore. ... Belt returned to the lineup after being limited to a pinch-hitting appearance Tuesday because of a sore neck.
Padres: LHP Matt Strahm (2-5, 4.03 ERA) is expected to come off the injured list to start against the Rockies in the opener of a four-game series Thursday at Colorado. Strahm has been out with a left rib strain.
Giants: LHP Drew Pomeranz (1-6, 7.16 ERA) tries to get his rocky season back on course Friday against Milwaukee. Pomeranz is winless in his last five starts and has the seventh-highest ERA among pitchers with at least 40 innings.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP—Sports