Stanislas Wawrinka was put through his paces against Tommy Robredo before eventually qualifying for the quarter-finals of the US Open.
The third seed beat Robredo 7-5 4-6 7-6 6-2 in New York and was comfortable in the final set after seeing off a spirited fight from the Spaniard in the third.
Robredo had two set points in the third, but Wawrinka held on and eventually edged out his opponent 9-7 in the tie-break.
Wawrinka will play either Milos Raonic or Kei Nishikori in the quarters.