Rafael Nadal has set up a semi-final meeting with Juan Martin del Potro at the Olympic Games in Rio.
The 2008 gold medallist overcame home favourite Thomaz Bellucci in three sets to book his place in the last four, eventually coming through 2-6 6-4 6-2.
The Spaniard, playing in his first major competition since withdrawing from the French Open with a wrist injury, soon found himself behind in the opener when Bellucci earned an early break.
The Brazilian looked to be on course for a shock on home soil when he added a second break later in the set, while losing just three points on his own serve to comfortably take the opener.
Nadal fought back in the second, though, and had the chance to serve for the set at 6-3, only for Bellucci to give himself hope of a straight-sets victory with a timely break.
The world number five broke straight back to win the set 6-4, though, and he carried that form into the decider with two more breaks to clinch the win.
Del Potro, meanwhile, beat Spain's Roberto Bautista Agut in straights sets to reach the semi-finals and will now look to go one better than the bronze medal he won four years ago.