The 40-year-old defeated Danka Kovinic of Montenegro 6-3, 6-3 in front of more than 23,000 fans on Arthur Ashe Stadium Court.
Former world number one Williams had won just one match on tour all year and seen her ranking slip to 605.
That kind of form prompted Williams to reveal that she was on the brink of retirement from the sport in which she played her first match as a professional in 1995.
On Monday, Williams, who arrived on court in a diamond-encrusted black dress and jacket which sparkled under the lights, overcame a nervy first game for a hold of serve.
The American star brought the crowd to their feet with a break for 2-0, chasing down a net cord to hit a winner.
Kovinic, the world number 80, has enjoyed a solid year at the Slams, reaching the third round of the Australian and French Opens.
The 27-year-old hit back with a break of her own and edged ahead for 3-2.
However, Williams buried the error count -- she served up six double faults in the opener -- levelled and then raced away with the next three games to take the first set.
Another break for 3-2 arrived in the second set on the back of crunching drives from the back of the court.
A love service game gave the American a 5-3 lead and a final break of the night gave her victory.
She celebrated with a little jig on the baseline and a broad smile.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)
Short link: