SAN FRANCISCO -- If Tim Lincecum wants to win without an overpowering fastball, he knows he will have to find his way through games when he is nowhere near his best.
And he was nowhere near his best Friday night. And yet, he still won.
"He was bobbing and weaving out there the whole game," Giants manager Bruce Bochy said.
Lincecum (4-3) struck out four and walked six in six innings. He allowed five hits and also had two wild pitches, escaping trouble in nearly every inning.
Only 57 of Lincecum's 112 pitches were strikes.
"You've got to battle when you don't have your best stuff, your best command. And today was just that," Lincecum said. "It's kind of an ugly win, but I'll take it.
Sandoval hit a three-run shot in the first, Hicks hit his eighth homer off Kyle Gibson (4-4) in the fourth and drove in another run on a flyout in the seventh.
Gibson gave up five runs and five hits in five innings, working quickly and in command for most of his 72-pitch outing. He struck out four and walked none.
"I really got beat on three pitches, which is the frustrating part," Gibson said.
San Francisco opened its six-game homestand with some pop at the plate and slick maneuvering on the mound.
Hunter Pence extended his hitting streak to 10 games with an infield single after Angel Pagan doubled leading off the first. Pence was originally ruled out, Bochy challenged the call and umpires overturned it after a 33-second video review.
Pagan was thrown out at home on Buster Posey's grounder, but not before third baseman Trevor Plouffe's throw pulled Brian Dozier off second on what would've been an inning-ending double play. Then, Sandoval sent the first pitch he saw over the brick wall in right to put the Giants ahead 3-0. It was Sandoval's fifth home run this season.
"I just focused and tried to calm myself down a little bit more," Sandoval said.
Mauer hit an RBI triple and Parmelee drove in another run for Minnesota in the third to slice San Francisco's lead to 3-2. In the bottom of the inning, Pagan tripled and scored for San Francisco after shortstop Eduardo Escobar couldn't corral Pence's grounder.
Despite his lack of command, Lincecum kept the Giants in control.
The two-time NL Cy Young Award winner, still searching for consistency as his fastball has faded in recent years, walked two and threw two wild pitches in the third without allowing a run. Sandoval fielded Gibson's grounder at third and threw out Escobar at the plate before Lincecum struck out Dozier to end the inning.
In the fifth, Lincecum loaded the bases before getting Escobar to hit a weak groundout to first. Lincecum's saved his smoothest inning for his final one, retiring the side in order before leaving to a standing ovation from the announced sellout crowd of 41,514.
Left-hander Jeremy Affeldt tossed a scoreless seventh for the Giants. After Javier Lopez allowed two baserunners in the eighth, Jean Machi got pinch-hitter Josmil Pinto to ground into a double-play before pitching a perfect ninth for the save.
"We were a little sloppy defensively and we missed plenty of opportunities to get some hits," Twins manager Ron Gardenhire said. "A rough start for us here, and that team over there knows how to take advantage of you."
The Giants will wait until at least Saturday to decide if RHP Matt Cain, who strained his right hamstring Wednesday at Colorado, will make his next start Monday against the Chicago Cubs. Bochy said Cain "was bouncing around pretty good" in the clubhouse. ... Mauer and Posey, who have each won an MVP at catcher, both started at first base. ... Twins RHP Samuel Deduno (1-2, 3.53 ERA), originally slated to start Sunday, will take the mound on Saturday. Ricky Nolasco will pitch Sunday. ... Ryan Vogelsong (2-2, 3.62) goes for the Giants on Saturday and lefty Madison Bumgarner starts Sunday.
Phillies' NL East-chase hindered in 2-0 loss to 100-loss O's
— Bryce Harper gave the 96 mph fastball a deep ride that had a few thousand straggling fans that paid for $1 hot dogs and a pennant race standing in euphoria.
Prospects who have taken the biggest step forward in 2021 for all 30 MLB teams
Which up-and-comers have jumped onto Kiley McDaniel's radar in 2021?
2021 MLB playoffs: Who is in, who can clinch next and full playoff schedule through World Series
October is right around the corner. Here's the latest on which teams will be playing in the postseason.
Montgomery expected to start for New York against Texas
Texas Rangers (55-95, fifth in the AL West) vs. New York Yankees (84-67, fourth in the AL East)
Woodford scheduled to start for Cardinals at Brewers
St. Louis Cardinals (80-69, second in the NL Central) vs. Milwaukee Brewers (91-59, first in the NL Central)
Blackburn scheduled to start as Oakland hosts Seattle
Seattle Mariners (81-69, third in the AL West) vs. Oakland Athletics (82-68, second in the AL West)