Martinez (15-3), who took a one-hit shutout into the sixth inning, matched David Cone of the New York Yankees for the most wins.
Anderson went 0-for-4 against Martinez and reliever Derek Lowe, ending the longest hitting streak in Angels history.
Martinez gave up six hits, struck out five and walked three in seven-plus innings. He won for the ninth time in decisions, losing his shutout bid on Jim Edmonds' 16th home run in the sixth.
Mike Benjamin and Damon Buford hit two-run homers as Boston improved to 4-1 on its West Coast trip. The Red Sox scored five times in the ninth, highlighted by Troy O'Leary's 19th home run.
The Angels, who remained atop the AL West despite going 9-18 in July, opened a new month with their fourth loss in five games.
Trailing 6-1, Anaheim tried to rally in the eighth. Singles by Gary DiSarcina and Darin Erstad and a walk to Edmonds loaded the bases, then Orlando Palmeiro hit a 2-run single that finished Martinez.
Lowe came on and struck out Cecil Fielder, retired Anderson on a comebacker and struck out Troy Glaus. Lowe pitched a perfect ninth for his fourth save.
Boston capitalized on an error by first baseman Dave Hollins, who let John Valentin's pop-up fall untouched behind the mound, to take the lead in the fourth.
Mo Vaughn followed with double for the first hit off Allen Watson (4-7), and Nomar Garciaparra's RBI single and Mike Stanley's sacrifice fly made it 2-0.
Benjamin followed O'Leary's walk in the fifth with his third homer, making it 4-0. In the sixth, Stanley walked in front of Buford's eighth homer.
Watson had not allowed a homer in 21 1/3 innings since coming off the disabled list on July 13. He led the majors in 1997 by giving up 37 homers.
© 1998 SportsLine USA, Inc. All rights reserved