The five-time former champion began the match looking unstoppable, powering winners off both wings past Giraldo, and in a little over 20 minutes he had moved 5-1 ahead.
But Federer struggles to find the consistency of old these days and he inexplicably dropped his serve twice in succession, the second time to love, before pulling himself together to take the first set.
The second was more of the same, with Federer, who made 35 unforced errors in the match, getting off to a flying start, being broken back, and then pulling away again.
Despite the third seed's wobbles, Giraldo never seemed likely to pose more than a passing threat, and in the third set Federer was totally in control, moving into a 4-0 lead and this time holding onto his serve to clinch victory in an hour and 46 minutes.
The 30-year-old next faces Israel's Dudi Sela, a five-set winner over Thomaz Bellucci on Monday.
Federer, who equalled Andre Agassi's tally of 224 grand slam match wins, second only to Jimmy Connors' 233, loves the night sessions and he was content with his display.
He said: "It's always one of those moments you train for, to get on the first night of the US Open. You try to put on a good show and I was able to play a good match today, so I'm pleased. It could have been swifter maybe but I'm happy."
Federer put his slight struggles down to adjusting to the slower pace of the courts this year, which he admits he is not a fan of.
The world number three added: "You're not getting many free points on your serve and maybe that was part of the inconsistent play over the first two sets.
"It's just unfortunate maybe that all the slams are too equal. This should feel very different to the Australian Open and it doesn't. I don't think it's really what tennis needs."