The third seed was in serious trouble before recovering to win 5-7 4-6 6-1 6-3 6-1 in stifling conditions at Flushing Meadows.
Murray goes on to face Brazilian 30th seed Thomaz Bellucci in the third round on Saturday. British number two Aljaz Bedene lost 3-6 6-4 6-4 6-2 to American Donald Young.
In the women's draw, Briton Jo Konta enjoyed a stunning three-set win over ninth seed Garbine Muguruza that lasted three hours and 23 minutes.
