Roddick's victory, completed in the early hours of Saturday morning, capped a day-long party for the Americans and their fans at Flushing Meadows after Lindsay Davenport, Meghann Shaughnessy and James Blake also advanced.
World number one Kim Clijsters inched towards her maiden Grand Slam crown earlier on Friday but it was the end of the road for emotionally-fragile ninth seed Daniela Hantuchova, who lost 6-2 6-4 in the third round to Thai Tamarine Tanasugarn.
Belgian Clijsters, seeded one at a Slam for the first time, swept aside Russia's Svetlana Kuznetsova 6-3 6-2 to reach the fourth round.
Next up for Clijsters will be 17th seed Shaughnessy, who overcame Russian 13th seed Vera Zvonareva 4-6 6-4 6-2.
Roddick probably did not plan to spend the first moments of his birthday sweating it out on a muggy centre court, but his spirited play against the hard-serving Ljubicic underlined his determination to gift himself his first career Grand Slam.
Ljubicic was not in a giving mood, making his American opponent work full out for the victory, forcing the match to a fourth set tie-break which Roddick finally clinched on his second match point 10-8.
HOTTEST PLAYER
It extended the hottest player on the tour's winning streak to 14 matches.
But as he was presented with a cake and the crowd broke into a rendition of "Happy Birthday", there was more relief written on Roddick's sweaty face than celebration.
"I think I deserve a beer after that one," said Roddick upon reaching the legal drinking age in New York. "I let him back in in the second set and then he started to play great tennis and I was in a battle."
Earlier in the day, third seed Davenport made a mockery of her fitness concerns with a 6-0 6-2 victory over Hungarian Melinda Czink while the unseeded Blake ousted Armenia's Sargis Sargsian 6-3 6-4 4-6 7-6 in the men's second round.
Hantuchova, who burst into tears during her second-round defeat at Wimbledon in June, looked on the verge of breaking down again on Friday evening as she was sent scurrying around centre court by Tamarine.
With her lower lip quivering, the Slovak looked to coach Nigel Sears in the stands but he could do nothing to ease her pain.
Tamarine, who mistakenly celebrated victory with an on-court jig two games early, saved her blushes by finally progressing.
She will next face fifth seed Amelie Mauresmo, who kept her U.S. Open title challenge on course with a no-nonsense 6-4 6-2 win over Russian qualifier and last year's junior champion Maria Kirilenko.
TENNIS LESSON
Playing in her first Grand Slam as a senior, 16-year-old Kirilenko fought hard in the opening set but in the second received a tennis lesson from Frenchwoman Mauresmo.
In other action, second seed Roger Federer's bid for a second consecutive Grand Slam gained momentum when the Wimbledon champion brushed aside Frenchman Jean-Rene Lisnard 6-1 6-2 6-0 to reach the third round. The Swiss player faces Blake next.
"I expect a good match...a fair match because he is a nice guy," Federer said.
"We have never played. It is nice to play a crowd favourite. I think it is going to be a good match and I am looking forward to it."
Former runner-up Mark Philippoussis made light work of Anthony Dupuis, smashing the Frenchman 6-2 6-3 6-4.
Wimbledon finalist last month and 20th seed here, the Australian is yet to drop a set at Flushing Meadows. He faces Argentine David Nalbandian in the third round.
Davenport, who took a pain-killing injection on her pinched toe nerve before the last Grand Slam of the year, looked increasingly confident in her movement and flexibility throughout her canter.
The result, coming after two previous straight-sets wins for the loss of seven games, also did wonders for her confidence.
"Before I arrived here, I didn't know what was going to happen," said the 27-year-old. "But this week is just what I needed. I've played well, my foot is feeling good and I've saved energy for the second week.
"Each day that goes by I'm getting more and more confident in my abilities...now I like to think I have a chance."