The Spanish world number five started sluggishly and lost the opener against his Argentine opponent, ranked 78.
Having bounced back to claim the second set, Nadal then edged a tough decider - in which he was broken early to trail 3-1 - to seal victory in two hours and 24 minutes.
''I knew there was a chance I was going to lose it, but luckily I was able to recover in the end,'' Nadal said.
''I'm very happy because it was a very difficult match against a great opponent. I'm happy to reach the semi-finals and now we'll see how it goes.''
Nadal next plays Martin Alund after the world number 111 downed Filippo Volandri of Italy 7-5 7-6(5).
The Argentine, who accounted for Jeremy Chardy in the second round, had never won an ATP match until arriving at the indoor clay-court tournament in Sao Paulo this week.
Nicolas Almagro's bid to win third straight Brazil Open title was ended by David Nalbandian, who won a lengthy three-setter 7-6(5) 3-6 7-6(3).
Second seed Almagro failed to capitalise on his chances, taking just two of 11 break points, allowing Nalbandian to go on and book a date with Simone Bolelli of Italy.
Bolelli beat Albert Montanes of Spain 6-4 6-4 to reach his first ATP semi-final since 2008
Brazil Open quarter-final results:
1-Rafa Nadal (Spain) beat Carlos Berlocq (Argentina) 3-6 6-4 6-4
David Nalbandian (Argentina) beat 2-Nicolas Almagro (Spain) 7-6(5) 3-6 7-6(3)
Martin Alund (Argentina) beat Filippo Volandri (Italy) 7-5 7-6(5)
Simone Bolelli (Italy) beat Albert Montanes (Spain) 6-4 6-4
- Sports & Recreation
- Simone Bolelli
- Nicolas Almagro
- Filippo Volandri
- David Nalbandian