SAN FRANCISCO — When the Giants traveled to Petco Park for the first series of the 2019 season, they helped the San Diego Padres inspire hope in the local fan base.

The young, exciting Padres turned heads with their energy, their raw talent and three wins in four games over a Giants squad that appeared slow, flawed and behind the times.

The Giants (28-38) haven’t exactly turned the tables over the last two months, but they managed to flip a switch against San Diego in this week’s two-game series that concluded with a 4-2 win at Oracle Park.

The Giants had the best rookie on the field in Wednesday’s win as starter Shaun Anderson outmatched Padres shortstop Fernando Tatis, Jr., who finished 0-for-4 at the plate with a pair of defensive miscues to boot.

“Any matchup with a big time player is good,” Anderson said. “(Tatis), (Manny) Machado, they’ve got a great lineup. When guys like that come up, you’ve got to execute your pitch and it’s that extra level of concentration, especially with young guys.”

Tatis generates plenty of buzz and attention –and for good reason– but it was Anderson who stole the spotlight Wednesday as he picked up his second career win with six solid innings of work.

For the second straight game, Giants third baseman Evan Longoria delivered a go-ahead base hit as his infield single in the top of the fifth brought home Donovan Solano to give the Giants a 3-2 lead.

“Today was my turn to help the team win,” Solano said through Spanish-language translator Erwin Higueros. “I just hope that tomorrow there’s somebody else that contributes and hope that we keep winning.”

Solano started Longoria’s at-bat on third base after Padres left fielder Josh Naylor committed a throwing error after he fielded a 68-mile per hour, game-tying blooper hit by the Giants second baseman. Solano’s single scored center fielder Steven Duggar, who made it to scoring position after Tatis threw the ball away on an infield hit.

Starting in place of Joe Panik against left-hander Joey Lucchesi, Solano provided the Giants with another RBI in the seventh inning as he yanked his second double of the season into the left field corner to bring home Duggar, who reached scoring position after an infield hit thanks to an errant throw from Padres reliever Robbie Erlin.

“You’re hoping he does wing it away, which he did,” manager Bruce Bochy said. “Speed does that for you.”

The seventh-inning score allowed Bochy to turn to his two most trusted relievers in the eighth and ninth innings for the second straight games as he called on lefties Tony Watson and Will Smith to finish off Anderson’s best home start.

The Padres loaded the bases thanks to a Brandon Crawford error, a Hunter Renfroe double and a Wil Myers walk, but Smith recorded his 16th save in 16 tries.

“It got a little scary there in the ninth, but Smitty made a pitch when he had to,” Bochy said.

Anderson made his major league debut less than a month ago, but he has rapidly developed into one of the most reliable starting options for Bochy.

Despite encountering trouble in the first, third and fifth innings against San Diego, the right-hander limited the damage and surrendered just two runs in six innings. Anderson joined staff ace Madison Bumgarner as the only Giants starter to log at least six innings in three consecutive outings this season as he’s now recorded three consecutive quality starts.

The three quality starts trail only Bumgarner’s 10 as Anderson moved into a tie with veteran Jeff Samardzija for second-most by a Giants pitcher this season. Five other Giants pitchers have tossed at least six innings while allowing three earned runs or fewer, but none have recorded multiple quality starts.

“Our bullpen is unbelievable, just the confidence you have in making a quality start and handing it over to the bullpen, you know it’s almost a shutdown inning,” Anderson said. “They work hard all year and the trust is awesome to have that back there.”

Anderson may not regularly strike batters out at an impressive clip, but he set a career-high with six in Tuesday’s start against San Diego. He also bested his previous career-high with 10 swinging strikes, including three on his changeup, a pitch Anderson only threw nine times to Padres hitters.

It’s still too early to know how Anderson will handle adjustments major league hitters make when presented with a more thorough scouting report, but his early success is reminiscent of the start fellow right-hander Dereck Rodríguez enjoyed in 2018.

In his first full month in the majors last June, Rodríguez tossed three quality starts while never striking out more than six in a game, proving that an ability to induce soft contact is still valuable. In an era where missing bats is of the utmost importance, Rodríguez’s struggles during his sophomore season are the result of command issues that prove how imperative it is for pitchers who lack elite velocity to limit location mistakes.

Kerry Crowley is a multimedia beat reporter covering the San Francisco Giants. He spent his early days throwing curveballs in San Francisco’s youth leagues before studying journalism at Arizona State University. Kerry has covered every level of baseball, from local preps to the Cape Cod League, and is now on a quest to determine which Major League city serves the best cheeseburger.