The world number one saved two set points in the opening set before recovering to win 7-6 (2) 6-2 6-2 and advance to the next round against Portugal's Joao Sousa after his five-set win over Jarkki Nieminen of Finland.
"It was a struggle," Djokovic said. "It was a lot of unforced errors, very windy conditions. You couldn't really read and kind of predict where the ball is going to go, so you have to be very alert.
"At the start I had difficulty with my footwork. But, as I won a set, after that it was very much better."
Tomas Berdych, the men's fifth seed, also won a tough three-setter, beating American Denis Kudla 7-6 (3) 7-6 (3) 6-3. The Czech made the semi-finals in New York last year and is in good form again this time.
He will next face Julien Benneteau after the 31st seed beat his fellow Frenchman Jeremy Chardy 6-4 6-3 6-4.
Germany's Tommy Haas and Mikhail Youzhny also won on Friday as all of the early seeded men moved on.
China's Li Na became the first player to reach the round of 16 when she defeated British teenager Laura Robson 6-2 7-5.
Li fired down 11 aces and needed just 81 minutes to avenge her third round loss to Robson at Flushing Meadows last year.
"I was a little bit surprised because today I have a lot of aces. It was like, wow," said Li, who plays Serbia's Jelena Jankovic next.
Robson contributed to her own downfall by committing 30 unforced errors, 15 in each set, but said she was happy with her steady progress in the game.
"I think I'm going in the right direction. I feel like I'm improving and working on a more all-around game," she said.
"It's going to take a lot of hard work, but I'm willing to do that."
The ultra-consistent Agnieszka Radwanska wore down Russia's Anastasia Pavlyuchenkova 6-4 7-6 (1) to also reach the fourth round, continuing her impressive streak at this year's grand slams.
If she wins her next match, the third-seeded Pole will become the only woman to reach the last eight at all four grand slams this year.
"Well, of course I will do everything to make the quarter-final this year," she said. "I like the hard court and I really had great results on that surface. I think it's just something wrong here that I can't pass the fourth round.
Sloane Stephens beat Jamie Hampton 6-1 6-3 in a battle between two of America's brightest prospects to set up a possible showdown with Serena Williams if the defending champion wins her night-time clash with Yaroslava Shvedova.
The defending men's champion, Scotland's Andy Murray, was due to face Leonardo Mayer on Louis Armstrong Stadium Friday afternoon.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO Sports and on Facebook at AhramOnlineSports)