SAN FRANCISCO (AP) — Tim Lincecum struck out eight to win his initial four starts for the first time in his career, San Francisco scored runs on a pair of errors and a wild pitch, and the Giants beat the St. Louis Cardinals 4-1 on Friday night to end a four-game losing streak.

Lincecum (4-0) — the two-time reigning NL Cy Young Award winner — has established himself as San Francisco's stopper, going 27-12 in 59 outings following Giants losses, including 3-0 this year. The Giants debuted their new orange jerseys for what's become a tradition known as "Orange Friday."

Yadier Molina singled in St. Louis' run in the sixth, but the Cardinals could do little else against Lincecum. In 2008, the hard-throwing righty started 4-0 in his first five starts.

With Lincecum on the mound and the bright new look, San Francisco got back on track to kick off a nine-game homestand on the heels of a disappointing 1-5 road trip. Nate Schierholtz singled in a run for the Giants.

The Cardinals (10-6) were off to an NL-best start, but now must win the next two games here to avoid dropping their first series of the season after capturing their initial five.

Lincecum, now with a 1.00 ERA, was done once reaching 120 pitches in seven innings. He allowed six hits and walked three. Sergio Romo pitched a scoreless eighth and Brian Wilson finished for his third save in as many chances, striking out the side.

Andres Torres led off with a double in the bottom of the first for San Francisco, coming around to score when shortstop Brendan Ryan's wild throw bounced into the stands. Mark DeRosa scored in the third on a fielding error by second baseman Skip Schumaker, then Aubrey Huff came home on a wild pitch by Jaime Garcia in the fifth.

Garcia (1-1) didn't get much help from his sloppy defense — or the offense — in his first career appearance against the Giants.

The lefty held the New York Mets hitless for five innings last Saturday and scoreless for seven, but the Cardinals lost 2-1 in 20 innings.

This time, Garcia allowed four runs — two earned — on seven hits in six innings, struck out two and walked three. He also reached on an infield single in the fifth for his first major league hit.

That had to put a smile on the face of first-year hitting coach Mark McGwire, who was thrilled to be back in the Bay Area where his career began. The slugger played 11 seasons for the Oakland Athletics, winning a World Series in 1989.

McGwire signed autographs in the dugout before the game.

San Francisco snapped a three-game skid against left-handed starters.

NOTES: Giants SS Edgar Renteria was scratched after his troublesome left shoulder began bothering him again. Juan Uribe moved to SS to replace him and Matt Downs was inserted to play 2B. ... Wilson has held opposing hitters to just two hits in 21 at-bats over his first six outings. ... Cardinals SS Felipe Lopez was given an extra day to rest his sore right elbow. He hasn't played since Tuesday. ... St. Louis C Jason LaRue (sore right hamstring) rejoined the team in San Francisco and took early batting practice. He's on schedule to return from the disabled list Tuesday. ... The Giants drew 42,860 for their fourth sellout of the year.