Cannot play media. Sorry, this media is not available in your territory.
Video - highlights of the day's action
Rafael Nadal will play Fernando Gonzalez in the final of the Olympic men's tennis tournament.
The Spaniard beat Novak Djokovic 6-4 1-6 6-4 to secure a final against 2004 bronze medallist Gonzalez, who beat James Blake in an epic encounter.
Blake had three match points at 6-5 in the deciding set but Gonzalez eventually triumphed 4-6 7-5 11-9.
Roger Federer, who will lose his world number one ranking to Nadal on Monday, reached the doubles final.
Federer, who is representing Switzerland, teamed up with Stanislas Wawrinka to beat India's Leander Paes and Mahesh Bhupathi in the quarters before defeating top-ranked American twins Bob and Mike Bryan 7-6 (8-6) 6-4 in the semi-finals.
"I'm very excited," said Federer, who was knocked out of the singles on Thursday by Blake.
"Having beaten the best in the world and going for gold, it's an incredible scenario. This is a big moment in my career."
Nadal closed out victory in dramatic fashion against Serbian Djokovic, who had already saved one match point with a thunderous forehand which Nadal was unable to return.
On his second match point a scrambling Nadal somehow retrieved two smashes by Djokovic and when he lifted another lob the Serb cracked under the pressure and fired it wide to send Nadal into the final.
"When I arrived here, I didn't expect for sure to be in this final," said Nadal.
"I arrived very tired, but when the week is coming, I felt better and better. I'm very happy to have this experience in my life."
Blake, who knocked Federer out of the singles, had plenty of chances against Gonzalez, but the world number 15 maintained his country's proud Olympic tennis record thanks to a gutsy display.
I did expect it a little more so in the Olympics when we're all competing under the banner of this event being to promote sportsmanship
James Blake accuses Fernando Gonzalez of a lack of sportmanship
There was little between the two players throughout a pulsating match, but Gonzalez claimed a decisive break to go 10-9 up in the third set - the only time either player dropped serve in the decider - and served out on his fourth match point to clinch victory.
Gonzalez, who took singles bronze in 2004 as well as pairing up to win the doubles with singles gold medallist Nicolas Massu, is now guaranteed at least a silver medal.
Blake was left frustrated, particularly by an incident when Gonzalez was serving at 8-9 in the decider and he felt that the Chilean had knowingly touched a ball that was then called out.
"Playing in the Olympics, in what's supposed to be considered a gentleman's sport, that's a time to call it on yourself," Blake complained. "Fernando looked me square in the eye and didn't call it.
"Should I expect him to do that [call it]? Maybe not. Maybe I shouldn't expect people to hold themselves to high standards, sportsmanship.
"But, yes, I did expect it a little more so in the Olympics when we're all competing under the banner of this event being to promote sportsmanship, to promote goodwill amongst countries."
Gonzalez denied touching the ball and was adamant that, had he done so, he would have admitted it.
"If I'm 100% sure about it, I will give it. But I'm not sure. I'm just moving, that's all," he said.
In the men's doubles final Federer and Wawrinka will meet Simon Aspelin and Thomas Johansson following the Swedes' victory over Arnaud Clement and Michael Llodra 7-6 (8-6) 4-6 19-17 in the longest three-set men's match in Olympic history.
The previous record of 54 games was set by Todd Woodbridge and Mark Woodforde in their semi-final win against Jacco Eltingh and Paul Haarhuis in Atlanta in 1996.