Madison Bumgarner struck out 11 over seven innings and the Giants snapped a 1-1 tie with their outburst in the seventh.
Tampa Bay starter Chris Archer (6-4) retired the first two batters in the seventh, but Hunter Pence reached on an infield single and scored the tiebreaking run on a triple from Brandon Belt.
Crawford was next and he hit Archer's first pitch over the wall in right. Belt's fifth-inning homer had rallied the Giants from an early 1-0 deficit.
Bumgarner (11-6) gave up the one run on seven hits in seven innings. Sergio Romo earned his 26th save by working a perfect ninth.
San Francisco won its third in a row. Tampa Bay has dropped back-to-back games for the first time since the final week of June.