Murray, who dealt with severe cramping in his first-round victory Monday, awkwardly pulled up after some shots in the third set, wincing and grimacing occasionally. He double-faulted to get broken and drop that set.
But Murray went up a break at 2-1 in the fourth and held on from there.
Murray, the 2012 champion at Flushing Meadows, is into the fourth round of the U.S. Open seven times in the last 10 years.
He has not reached the final at any tournament since winning Wimbledon in July 2013.