Despite storming to an early lead Belarusian Azarenka, who needs to win gold to guarantee retaining the world number one ranking, dropped the second set to Romania's Irina-Camelia Begu before regaining her pose to take the match 6-1 3-6 6-1.
"Today I couldn't get into the match in the second set. There were too many mistakes, but I'm glad I could turn things around and finish as strong as I started," said the 23-year-old, who kissed the net at the end of the match after her final shot bounced off it before dropping on the winning side.
"I get more nervous when I play for my country than when I play for myself. Hopefully, the next round will be much easier," she said after the match, which had been delayed from Sunday due to rain.
World number one Federer, who dropped a set in a first-round wobble against Colombia's Alejandro Falla on Saturday, made easier work of his second round tie, defeating France's Julien Benneteau 6-2 6-2 in less than an hour.
Federer was taken to five sets by Benneteau in the third round at Wimbledon last month, and came back from two down before going on to win the match and then the title for the seventh time.
The Swiss 17-times Grand Slam champion was back in action in the men's doubles, where he and partner Stanislas Wawrinka were put through their paces by J a pan's Kei Nishikori and Go Soeda before securing a 6-7 6-4 6-4 win to start the defence of their Beijing gold medal.
American Venus Williams, aiming to become the first tennis player to win four Olympic golds, made easy work of her first-round singles match against number nine seed and French Open finalist Sara Errani.
Venus dispatched the Italian 6-3 6-1 in just over an hour before chanting "U-S-A, U-S-A" with a delighted Court Two crowd.
At the same time on Court One, her sister and doubles partner Serena advanced to the third round with a 6-2 6-3 win over Poland's Urszula Radwanska, while later eighth seed Denmark's Caroline Wozniacki dropped a set against Belgium's Yanina Wickmayer in her 6-4 3-6 6-3 second-round win.
In a packed schedule of play, due to a rainy Sunday which meant just 12 of 48 matches were completed, the Williams sisters also took to court for a second time on Monday to defend their women's doubles title with an easy 6-3 6-2 over Romania's Sorana Cirstea and Simona Halep.
To the delight of a noisy home crowd, Britain's Laura Robson and Heather Watson, who both got into the singles after injury withdrawals, booked their places in the second round. Robson, ranked 96 in the world, beat number 23 Czech Lucie Safarova 7-6 6-4 while Watson saw off Spaniard Silvia Soler Espinosa 6-2 6-2.
"I loved the crowd, they were amazing. It's completely different to Wimbledon, they were a lot louder. I love it, I love loud," said Watson, laughing.
With players getting used to a noisier crowd than at the usually sedate Wimbledon, America's Andy Roddick was in good spirits during his 7-5 6-4 win over of Slovakia's Martin Klizan.
"Don't worry, it will get better," he joked when a baby started crying as he went to serve in the second set.
But it may not get better for the world number 22, who now faces second seed Djokovic in the second round.
"The biggest thing about the top guys is that they don't make mistakes when they should make mistakes, they repeat the same pattern over and over and over," said 29-year-old said.