Rafael Nadal avoided successive shock losses on clay as he began his Barcelona Open title defence with a 6-7 (7-9) 6-4 6-2 win over Leonardo Mayer.
The top seed, 32, lost to Fabio Fognini on Saturday in the Monte Carlo Masters semi-finals, and on Wednesday struggled at times against Argentine Mayer.
The 11-time French Open champion will now play fellow Spaniard David Ferrer in the last 16.
Ferrer, 37, recorded a 6-3 6-1 win over 15th seed Lucas Pouille.
Also through is Argentine Guido Pella who beat sixth seedKaren Khachanov 6-2 7-6 (7-4).