SAN FRANCISCO -- The Giants halted the Los Angeles Dodgers' dominance at AT&T Park with a 6-5 victory Friday night that featured intrigue as well as excellence.

San Francisco's pitchers accounted for the intrigue -- plenty of it.

Tim Lincecum unveiled a new delivery and generated the same old success, striking out nine and stranding eight baserunners in seven innings.

Back spasms kept closer Brian Wilson unavailable, which didn't become obvious until the ninth inning unfolded and Los Angeles rallied for three runs. The Giants used four pitchers before Chris Ray coaxed a grounder from Casey Blake with the potential tying and go-ahead runs on base to end the game.

Aubrey Huff, the Giants' leading Most Valuable Player candidate, embodied the excellence. He hit his 20th homer while driving in three runs and made two essential defensive plays -- one in each outfield corner.

All of this entertained a turbocharged sellout crowd at AT&T Park, where San Francisco improved to 9-0 wearing its home orange jerseys. Maybe that was the talisman the Giants needed against the Dodgers, who entered the game with a 26-13 record in San Francisco dating to 2006, including a three-game series sweep here June 28-30.

More importantly, the Giants' 18th victory in 23 games trimmed their National League West deficit to 2 1/2 games behind first-place San Diego.

"We haven't played very well in our division [16-21] or against [the Dodgers]," Giants manager Bruce Bochy said. "That's why we were doing all we could at the end, trying to get outs, to close that game out."

That's typically Wilson's job. But the All-Star who has recorded 30 saves in 33 chances was privately forced to remain sidelined after reporting to the ballpark around 2 p.m. with his back "locked up," in his words.

Time and a massage helped Wilson feel better as the evening progressed, but Bochy stuck to the medical orders. Otherwise, Wilson might have dashed to the mound without permission.

"You guys know me by now," Wilson said. "I want to pitch. I'll go out there with a broken leg."

As Wilson paced the dugout like a caged panther during the ninth inning, which began with the Giants leading 6-2, Sergio Romo yielded Scott Podsednik's one-out RBI triple. Denny Bautista accelerated the Dodgers' momentum by walking Rafael Furcal, which brought the possible tying run to the plate.

With left-handed batters Andre Ethier and James Loney due up, Bochy summoned Jonathan Sanchez -- who had refrained from his between-starts throwing session in case the Giants absolutely, positively needed a left-handed reliever to stand in for the injured Jeremy Affeldt and Dan Runzler.

Sanchez, who made his last relief appearance on July 3, 2009, flung a wild pitch that scored Podsednik before striking out Ethier. Loney walked, prompting Bochy to call upon Ray, the former Orioles closer. Ray surrendered Matt Kemp's RBI single but ended the drama by coaxing Blake's grounder.

"It felt like Willie was in there, it was so exciting," Bochy joked, referring to Wilson's penchant for pitching in and out of trouble.

Even before that, Lincecum (11-4) made this a notable evening for the Giants by employing a revised windup, bringing his hands over his head as he wound up to throw. Lincecum hadn't used this motion since he tried it once while playing for the University of Washington -- in a defeat, of all things.

Gaining better balance was Lincecum's goal with what he called his "twerk," which apparently was a variation of a "tweak." Bottom line: He allowed two runs and seven hits in seven innings while improving to 5-1 lifetime against the Dodgers.

"Just so I could stay over my back foot longer," he said, explaining his change. "Lately I've had a tougher timing issue in my windup. [I wanted to] mess around with a little twerk. I guess for me it's a big twerk."

The rest of the evening belonged to Huff. His quick fourth-inning relay from right field to second baseman Freddy Sanchez helped apprehend Furcal, who was trying to stretch a double. Then, having moved to left field, Huff opened the seventh inning with a running catch of Jamey Carroll's drive to the warning track.

Batting .500 with runners in scoring position during July, Huff gave the Giants a 3-2 edge in the third inning with a two-run double, which he delivered one pitch after heading for first base after Dodgers starter Carlos Monasterios (3-3) threw what Huff considered to be ball four.

"I tossed the bat, so I knew if it was anywhere close, I better swing," Huff said.

Huff's sixth-inning single began another two-run outburst for the Giants before he completed his blissful evening with his seventh-inning homer. Hours earlier, Huff surveyed the ballpark scene -- the stands filling, the "Beat L.A." chants already ringing -- and reveled in it.

"That's the kind of atmosphere I've been waiting my whole life for," Huff said.