Suarez Navarro was brushed aside in the first set but battled back against Ukraine’s world number four by scraping through a second-set tiebreak to set up a dramatic third.
Breaking to go 5-4 up, Suarez Navarro spurned four match points after leading 40-0 before taking a tumble on the final point but Svitolina sent her return long and the Spaniard burst into tears in front of the raucous home supporters.
“I’m feeling great, I’m very happy because, at the end of the day, these type of victories are the victories that you need,” said 29-year-old Suarez Navarro, the world number 25.
In the second set, the Spaniard slipped and appeared to hurt her ankle, which was already strapped.
“I fell down because I twisted my ankle, my right ankle, but I feel good,” she said. “I mean, I fell down in the second set (but) I could play all of the final set. Now (I will have) a little bit of treatment, but I will be fine for tomorrow.”
Suarez Navarro will play American Bernarda Pera in the third round after she saw off Britain’s Johanna Konta 6-4 6-3.
Halep trounced out-of-sorts Elise Mertens 6-0 6-3 to reach the third round and stay on course for her third consecutive title at the event.
The Romanian top seed wrapped up victory in just over an hour, hitting 23 winners with only 18 unforced errors as she ended the Belgian’s 13-match winning streak.
Mertens has triumphed in Morocco and Switzerland this year but her form deserted her as she struggled to cope with Halep’s combination of power, guile and relentless court coverage.
“I had to start the match very strongly and aggressively, which I did,” said Halep. “After I played a few games, I felt really good on court. I felt very confident that I could win that match, I think I played well again.”
Halep will face Kristyna Pliskova in the last 16 after the Czech beat Spaniard Sara Sorribes Tormo 7-5 6-2.
Garbine Muguruza struggled at first against Donna Vekic but the third seed eventually found her game to win 2-6 6-4 6-1.
Muguruza has often struggled at the Caja Magica and after Vekic broke the Spaniard three times in the first set it looked like she was going to suffer again.
However, as her Croatian opponent tired, Muguruza improved in equal measure and won the final set comfortably to set up a third-round clash with 14th seed Daria Kastakina of Russia.
Petra Kvitova, seeded 10th, edged wild card Monica Puig 6-3 7-6(8) and in the third round faces Estonia’s Anett Kontaveit, who beat Belarusian Aliaksandra Sasnovich 6-2 4-6 6-2.
Kvitova dished out nine aces but made an equal number of double faults as she held on to extend her winning streak to seven matches despite her opponent’s aggressive brand of tennis.