Making his seventh major-league start, Richards (1-3) overcame a wild start but allowed just two hits, three walks and one run in six innings. He struck out two.
Richards, 25, has come a long way since he went undrafted out of Drury, an NCAA Division II university in Missouri. Richards made his pro debut in an independent league before ultimately signing with the Marlins.
Miami's offensive stars on Tuesday were shortstop JT Riddle, who hit a go-ahead, two-run double; and second baseman Starlin Castro, who went 2-for-4 with one RBI. Riddle also made a stellar defensive play.
San Francisco was held to three hits - all singles - and that lack of support cost Giants starter Chris Stratton (7-4), who allowed four hits, three walks and three runs in seven innings.
Riddle made a diving stop and assist on the play, preventing further damage and allowing Richards to settle down the rest of the way.
Miami took a 3-1 lead in the third, loading the bases with one out on a single by Derek Dietrich, a Brian Anderson hit-by-pitch and a walk to Justin Bour. Castro tied the score with an RBI single, and Riddle put Miami on top with his two-run double pulled to right-center.
That was all the offense the Marlins needed as 13 of the Giants' final 14 batters were retired. The only batter to reach in that span, Hunter Pence, who singled in the eighth inning, was erased in a double play.
Miami has won the first two games of the series.
--Field Level Media