World number one Azarenka won 6-7 (6/8), 6-4, 6-2 and will face German qualifier Dinah Pfizenmaier for a place in the last 32, but she flirted with disaster for much of her 2hr 16min battle on Philippe Chatrier Court.
"I was lucky," admitted the Belarussian.
"I made 60 unforced errors and that says it all. Bad days happen, I made way more mistakes than usual. I still got through and to commit so many errors and still win, that's a good statistic."
She also admitted that victory was down to a change in mindset on her part.
"Before maybe I would have given up and thought about what was the time of the next flight back to Minsk, but I didn't want to leave too soon. She pushed me all the way. I had to dig deep."
The 32-year-old Brianti, who had never won a match in four previous main draw appearances at Roland Garros, was left to regret squandering a break point in the fifth game of the second set.
She was on the verge of a 5-0 lead when Azarenka sent down a second serve ace to stay in contention, the point proving to be the significant moment in the tie.
Azarenka, who won her first Grand Slam tournament at the Australian Open this year, came into Roland Garros nursing a shoulder injury which had forced her to pull out of the Italian Open two weeks ago.
And it appeared that she was heading for a shock exit until she reeled of 12 of the last 14 games as Brianti ran out of steam.
The 22-year-old Azarenka had started confidently, taking a 2-0 lead over the Italian.
Brianti, the world 105, then hit back by winning the next four games for a 4-2 lead.
Three more breaks of serve followed in an increasingly untidy opener with the top seed having to save a first set point in the 10th game.
Brianti raced into a 5-1 lead in the tiebreak, but was unable to convert two more set points as the Belarusian grimly hung on, hitting back to level at 6-6 in the process.
But Azarenka eventually wilted when a forehand went long to hand the Italian a one-set lead.
Things didn't get any better for Azarenka in the second set as she fell 4-0 down, slumping to her knees in the process.
However, after saving a break point to avoid slipping 5-0 down, she then reeled off six games in succession to level the match as Brianti suddenly looked like someone who has never beaten a top 10 player.
The Italian managed to break for a 1-0 lead in the decider, but once Azarenka had steamed ahead to 5-2, her chance of making history had gone.
(For more sports news and updates, follow Ahram Online Sports on Twitter: @AO Sports)
Short link: