Serena Williams made the quarter-finals of the Sony Ericsson Open with a hard-fought victory over US Open champion Sam Stosur.