Venus Williams was given a fright by Garbine Muguruza before progressing to the quarter-finals of the Brazil Tennis Cup.