Murray comes through three-set battle to reach quarter-finals in Gijon