Brian Anderson and J.T. Realmuto led the tenacious Marlins to an impressive win over the Giants.