World number one
Belarusian Azarenka, winner of four titles this year including her first Grand Slam singles at the Australian Open, needed four match points to finish off a stubborn Ivanovic and will play China's
Li, the French Open champion and eighth seed, beat 12th-seeded German
Ivanovic, who has never been past the second round in two previous appearances in the Spanish capital, made a strong start on the blue clay of the Manolo Santana show court and conjured an early break of the Azarenka serve.
However, she tripped up at crucial moments during the remainder of the match and failed to convert three break points in the final game.
"I think she started really strong and I was a bit too slow and not aggressive enough," Azarenka, who hired another former number one, Frenchwoman Amelie Mauresmo, as an adviser last month, told a news conference.
"I was just trying to stay in there and execute better and get some rhythm into the match," she added.
Kvitova, the world number four and seeded third this year, used her 2011 success in Madrid as a springboard for a first Grand Slam singles title at Wimbledon and went on to triumph at the season-ending WTA championships.
The graceful left hander has yet to win a title in 2012, however, after claiming six last season, and had her serve broken five times by Hradecka, who is ranked 105th in the world and claimed a first win against a top 10 player of her career.
There were no such problems for
Radwanska snapped Errani's 16-match winning streak on clay, which netted her titles in Acapulco, Barcelona and Budapest, with a dominant performance, crushing the Italian 6-0 6-1 to set up a third-round meeting with another Italian, Roberta Vinci.