SAN FRANCISCO - Tim Lincecum has talked the past few years about rediscovering the consistency that won him two NL Cy Young Awards and made him one of baseball's best pitchers.

Lincecum's last two outings have brought him awfully close to finding that form again.

The rejuvenated right-hander followed his second career no-hitter with another vintage performance, pitching eight sharp innings to lead the San Francisco Giants past the St. Louis Cardinals 5-0 on Tuesday night.

"We try to go out there and duplicate when things are feeling good," Lincecum said. "We tried to do that today. All my pitches were working when I threw them. They weren't super nasty — they were just located a little better than usual."

Maybe more than a little.

Lincecum (7-5) allowed four hits, struck out six and walked two. He worked out of a bases-loaded jam with no outs in the fourth and stayed out of trouble the rest of the way, helping San Francisco snap a four-game losing streak since his latest gem against San Diego.

Lincecum left after throwing 113 pitches, including 73 for strikes — the exact same line as his no-hitter against the Padres last week — before Jean Machi pitched a drama-free ninth.

"I think the two (starts), if you look at them, it's hard to find a big difference," Giants manager Bruce Bochy said. "It's a guy that had command of all his pitches."

Pablo Sandoval hit his 100th career homer to cap a three-run fourth for the Giants, and he got a bottle of bubbly in the clubhouse afterward. San Francisco also scored twice in the fifth to chase Marco Gonzales (0-1) in the left-hander's second career start.

Gonzales gave up five runs and seven hits in 4 1-3 innings. St. Louis has lost three straight and four of five in a tough stretch against the league's hottest pitchers.

The Cardinals faced a pitcher with a no-hitter this season for the third time in five games. After Josh Beckett and Clayton Kershaw led the Los Angeles Dodgers to victories over St. Louis, Allen Craig singled with one out in the second to put an early end to Lincecum's bid for another no-hitter.

Lincecum, who has shown signs of returning to his dominant form of late, showed the poise and polish of his younger days even when things started to go awry.

Lincecum loaded the bases in the fourth before striking out Craig and Jon Jay and getting Daniel Descalso to ground out. Lincecum pounded his glove and received a standing ovation from the announced sellout crowd of 41,152.

"It gets you fired up," right fielder Hunter Pence said.

"When a guy's making good pitches, you get him on the ropes you've got to make him bleed a little bit. That one slipped away," Cardinals manager Mike Matheny said.

San Francisco supplied all the support Lincecum needed in the bottom of the inning. Buster Posey's double drove in a run before Sandoval's wind-aided fly carried just over the wall in left to give San Francisco a 3-0 lead.

"It's hard to hit one," said Sandoval, who wore his "lucky" boots for the first time in weeks trying to break San Francisco's skid. "I'm excited to get this moment."

Pence hit an RBI double and Hector Sanchez drove in another run in the fifth to put the Giants up 5-0.

The performance from San Francisco's leading men — Lincecum, Sandoval, Posey and Pence — was a welcome turnaround for the team's fans. The Giants entered the game 1-6 on their homestand, including four straight losses to Cincinnati. It was the first time San Francisco had been swept in a four-game series at its waterfront ballpark, which opened in 2000.

NOTES: Giants CF Angel Pagan is scheduled to be examined by a specialist in Los Angeles on Wednesday after having a setback in his recovery from a back injury while running. Pagan said he has a bulging disk in his back that is pinching a nerve and causing pain in his legs. .... The Cardinals recalled top prospect Oscar Taveras and started him in RF, giving Matt Holliday a day off. Taveras went 0 for 3 with a walk. ... Cardinals ace Adam Wainwright (10-4, 2.01 ERA) starts opposite Giants RHP Ryan Vogelsong (5-4, 3.96 ERA) on Wednesday.