Rafael Nadal reached the semi-finals of the Brazil Open but needed to draw on his reserves to see off Argentine Carlos Berlocq 3-6 6-4 6-4.
The Spaniard is playing in his second tournament following a seven-month absence from the tour due to injury.
The world No 5 made a tentative start as he conceded the opening set to the 30-year-old, who is ranked 73 places below him on the ATP ladder.
But he found his range with his powerful serve in the second set and produced some clever drop shots to help secure victory after two hours and 24 minutes on court.
"For me every victory is important. It is the moment to have the necessary humility to fight in every match as I did today," said Nadal, who was beaten in the final of the Vina del Mar Open in Chile last weekend.
"It's the first match I win in three sets here. It helps me get better physically. It helps me regain my self-confidence."
The top seed will now face another Argentine in the last four in the shape of Martin Alund while David Nalbandian and Simone Bolelli will contest the other semi-final.