World number 74 Ozaki had been two breaks ahead in the third set and was serving at 5-4 when darkness descended on the Santa Ponsa lawns on Tuesday.
On the resumption, the 27-year-old Azarenka broke serve but immediately dropped her own before Ozaki moved 40-0 ahead to get to within a point of a victory.
But Belarussian Azarenka, showing her trademark grit, clawed her way back from the brink and despite trailing 5-3 in the tiebreak sealed a remarkable victory with a backhand winner.
"I'm still trying to find my range but mentally, I was there for every point. That and the experience helped me through, even at 40-0 down, I was trying to find my way out of it," wildcard Azarenka, who next plays Croatian youngster Ana Konjuh, said.
"I wouldn't say I had the best preparation coming to this tournament, but mentally, it's better to go through this kind of a match."
Top seed Anastasia Pavlyuchenkova of Russia was thrashed in the second round by Germany's Julia Goerges 6-1 6-2.
(Reporting by Martyn Herman; Editing by Gareth Jones and Ed Osmond)
Share
