© Getty Images
In doing so, the Frenchman has equalled his best performance at a Grand Slam, six years after reaching the last four of Wimbledon.
The 27-year-old looked to be sailing into the semi-finals after taking the first two sets 6-3 6-1 in scintillating fashion.
However, the Spaniard showed his characteristic mettle at Flushing Meadows, battling back to take the next two 6-4 6-2.
Despite having all the momentum heading into the decider, the dogged 31-year-old fell at the final hurdle, as Gasquet regained his focus to wrap up the fifth set 6-3.