Serb Ivanovic, a first-round casualty at San Diego last week, had appeared set for another early exit before rallying to beat the in-form Belarusian, who won the Stanford Classic earlier this month.
The 2008 French Open champion Ivanovic briefly held the world's top ranking that year, but a subsequent collapse in form and a series of niggling injuries have seen her ranking slip to 62nd. The Serb was joined in the second round by another fallen former top-ranked player in Russia's Dinara Safina, who eased to a 7-5, 6-4 win over Italy's Roberta Vinci.
Safina was also forced to dig deep, rallying from 3-5 down in the opening set before closing out her fifth win against the Italian from five matches.
The 24-year-old, now ranked 35 and yet to make a semi-final this season after returning from a back injury that sidelined her for three months, will next face Belgian Kim Clijsters.
Israeli Shahar Peer advanced after Olga Govortsova of Belarus retired when trailing 6-3, 4-1, while France's Marion Bartoli thrashed Spain's Anabel Medina Garrigues 6-4, 6-0.
Bartoli's compatriot Aravane Rezai was not so fortunate, however, being dumped out by Serb qualifier Bojana Jovanovski 4-6, 6-3, 6-4.
Sharapova, Bartoli reach Stanford quarter-finals
Dinara Safina wins Slovenia Open
Bartoli ousted at Stanford, Stosur battles on
Sharapova, Suarez advance
Injured Gulbis pulls out of Wimbledon