SAN FRANCISCO (AP) -- Anibal Sanchez pitched a one-hitter for his first shutout since a no-hitter in September 2006, and Jorge Cantu played his final game for Florida in the Marlins' 5-0 victory over the San Francisco Giants on Thursday.
Sanchez (8-6) retired his first 13 batters and matched a career-high with eight strikeouts.
The Marlins traded Cantu to AL West-leading Texas. He was replaced on defense by Wes Helms in the bottom of the eighth.
"I'm going," Cantu said after the game.
Mike Stanton hit a pair of RBI doubles, and Ronny Paulino had two sacrifice flies for Florida.
Giants rookie Buster Posey had his hitting streak snapped at 21 games, one shy of tying Hall of Famer Willie McCovey's San Francisco rookie record, set in 1959.
Sanchez retired Freddy Sanchez on a liner to left on his 118th pitch, ending his gem in 2 hours, 7 minutes. He struck out eight for the fifth time in his career.
It was his third career complete game and second shutout. He pitched the no-hitter on Sept. 6, 2006, against Arizona. He tossed his previous complete game on Sept. 16 that year.
Juan Uribe reached on Cantu's throwing error to start the fifth for the Giants' first runner. Cantu fielded Uribe's two-hopper but first baseman Gaby Sanchez couldn't hold onto Cantu's throw after scooping it.
Pablo Sandoval blooped a clean single into shallow left-center moments later. After that, Aubrey Huff's leadoff walk in the seventh was San Francisco's only other runner.
Rookie Madison Bumgarner (4-3) had a four-start winning streak snapped.
Posey, who batted .440 with six homers and 23 RBIs during his streak, went 0 for 3 with two strikeouts and also grounded into a double play.
Florida avoided its first three-game losing streak since June 30-July 3.
San Francisco never threatened against Sanchez a day after the Giants blew leads of 7-1 and 9-2 before winning 10-9 in the 10th inning.
The Marlins are in a stretch of 17 straight games since the All-Star break without an off day, getting their first break Monday. They first must finish this seven-game West Coast trip at NL West-leading San Diego this weekend.
Notes: Florida LF Chris Coghlan, who tore the meniscus in his left knee while delivering a pie in the face to teammate Wes Helms after an 11-inning win over Atlanta on Sunday, will be examined again in the coming days. Surgery could be necessary.... Marlins RHP Alex Sanabia likely will be available out of the bullpen beginning Saturday at San Diego. ... Giants manager Bruce Bochy plans to give Posey a break from his catching duties in the next couple of days, likely starting him at 1B instead. ... San Francisco has talked about adding an LHP reliever or hitter before Saturday's trading deadline. Former 20-game winner Dontrelle Willis, signed to a minor league contract July 15, has begun throwing to hitters and could be ready soon -- so that could affect the Giants' decision. Willis was designated for assignment by Arizona earlier this month. "We talked about both," Bochy said of a hitter and reliever. "I can't say one is ahead of the other." ... Giants RHP Todd Wellemeyer, on the disabled list since June 11 with a strained right quadriceps, is scheduled to pitch again Friday for Triple-A Fresno in a rehab start.