Nadal jumped and thrust both arms into the air after he closed the match against the 78th-ranked Berlocq in 2 hours, 24 minutes, staying on track to win his first tournament after a long layoff to recover from a left knee injury.
With the crowd behind him, Nadal broke Berlocq's service in the final game of the match to secure the victory and a spot in the semifinals.
Berlocq had broken Nadal's service early in the third set to go up 3-1, but the Spaniard recovered and took advantage of a couple of double faults by Berlocq to start the final game.
"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 semifinals and now we'll see how it goes."
Nadal will face 111th-ranked Martin Alund, who beat 88th-ranked Filippo Volandri of Italy 7-5, 7-6 (5). The 27-year-old Argentine never had won a match at the top tour level until he came to Sao Paulo. He beat 25th-ranked and fourth-seeded Jeremy Chardy of France in the second round.
"I know very little about him but he has been having a spectacular tournament," Nadal said. "He has been playing very well and is coming into the match with a lot of confidence."
Nadal was broken twice in a row in the first set and had to save a break point early in the second. He squandered three straight chances to break Berlocq's service a few games later before finally coming through at 4-5 to clinch the set and stay alive.
Despite the victory, Nadal didn't appear in his best shape and had a slight limp at times toward the end of the match.
There was a tense moment in the seventh game of the first set after Nadal sprinted to try to reach a drop ball near the net. He nearly fell and immediately started limping, apparently favoring his injured left knee, but replays eventually showed that he only slightly twisted his ankle and he seemed fine the rest of the match.
The match was stopped for a few minutes after the play as organizers had to work to fix a damaged spot on the court. Many players, including Nadal, had criticized the temporary clay court at the Ibirapuera arena, saying it was too slippery and unsafe at times. Nadal also attacked the ATP and complained of the bad quality of the ball provided in Sao Paulo.
Nadal was out of action for nearly seven months because of his knee injury. He returned to action last week at the VTR Open in Vina del Mar in Chile, losing the final in both singles and doubles.
The 26-year-old Spaniard has been saying there is still pain in his knee but it is improving considerably. The 11-time Grand Slam champion will also play in Acapulco, Mexico, this month.
The 30-year-old Berlocq was trying to win his first ATP title. He reached the semifinals in Chile last week, losing to eventual tournament winner Horacio Zeballos, the Argentine who beat Nadal in the final.
Almagro's hopes of winning a third straight Brazil Open title ended in the quarterfinals when he lost 7-6 (5), 3-6, 7-6 (3) to Nalbandian, who is seeking his first title since 2010.
The second-seeded Spaniard, 11th in the world, played well but failed to capitalize on his opportunities against the 93rd-ranked Nalbandian. He had 11 break chances but converted only two of them, while the Argentine took advantage of one of his four break points.
Almagro had 28 aces against five for Nalbandian, but it was not enough as the Argentine played better in both tiebreakers to win the match in 2 hours, 17 minutes.
The 31-year-old Nalbandian, who was No. 3 in the world in 2006, is making his season debut in singles at the Brazil Open. He withdrew from the doubles tournament earlier in the week because Nadal, his partner, decided to rest his injured knee.
Almagro was looking for his fourth title in Brazil, having also won the tournament in 2008. This was his first event since his five-set loss to compatriot David Ferrer in the Australian Open quarterfinals in January.
The 80th-ranked Bolelli, who successfully played challengers last year to get back into the top 100, broke Montanes' service twice in the final set. The Italian converted three of his 11 break point opportunities and had five of his nine aces in the second set.
Bolelli upset third-seeded Juan Monaco of Argentina in the second round Thursday.