World number one Novak Djokovic missed out on an Olympic singles medal as Spain's Pablo Carreno Busta sealed the bronze in Tokyo.
Serb Djokovic, 34, whose gold-medal bid was ended by Alexander Zverev on Friday, lost 6-4 6-7 (6-8) 6-3.
Djokovic, who can still win bronze in the mixed doubles, succumbed on the sixth match point as world number 11 Carreno Busta fell to the court in joy.
Zverev takes on Russian Karen Khachanov for singles gold on Sunday.
In the women's singles final later on Saturday, Switzerland's Belinda Bencic faces Czech Marketa Vondrousova.
Djokovic had arrived at the Games seeking to become the first man to win a 'Golden Slam' - Olympic gold plus all four Grand Slams.
He had already won the Australian Open, French Open and Wimbledon this year and will still have the opportunity to complete a rare calendar Grand Slam at the US Open, which starts at the end of August.
But these Games, where big rivals Rafael Nadal and Roger Federer were not playing, represented his best chance of the 'Golden Slam' with his next opportunity now not until 2024, when he will be 37.
Djokovic saved a match point against Carreno Busta in the second set to force a decider but his frustrations boiled over early in the third when he failed to break, throwing one racquet into the empty stands and smashing another against the net post as the Spaniard held his nerve for victory.
Djokovic has another opportunity for a medal later in the day when he teams up with Nina Stojanovic to face Australians John Peers and Ashleigh Barty in the mixed doubles bronze medal match.