Rafael Nadal and Marc Lopez came through a gruelling three-set match with Florin Mergea and Horia Tecau to claim gold for Spain in the men's doubles final at Rio 2016.
Nadal was a doubt for the Olympics after missing Wimbledon with a wrist problem, but could yet earn two golds in Brazil, after also reaching the semi-finals of the men's singles on Friday.
A 6-2 3-6 6-4 victory alongside Lopez enabled the 14-time grand slam champion to claim the second Olympic gold of his career, Nadal having secured the singles title in Beijing eight years ago.
Yet the eventual victors were pushed to the limit as Romania's Mergea and Tecau overcame a poor start to put up a fabulous fight at the Olympic Tennis Centre.
The Spanish pair wrapped up the opening set in 33 minutes and looked set to prevail with a degree of comfort.
However, Mergea and Tecau moved 3-1 up in set two courtesy of Nadal netting a volley. And although Nadal and Lopez got to 0-40 as their opponents served for the set, all three opportunities were spurned and two Tecau smashes levelled the match.
Five more break points were saved by the Romanians in the fourth game of the decider, a mammoth affair that also saw Mergea twice double-fault on game point before eventually holding.
That looked set to prove crucial when Lopez was broken to love to give Mergea and Tecau a 4-3 lead, but the Spaniards hit back immediately to pull level once again.
Tecau showed admirable nerve to put away two further smashes when Spain forced two gold medal points on his serve at 4-5.
Yet Mergea then made a mess of successive overheads to hand Nadal and Lopez a hard-fought victory.
The United States' Jack Sock and Steve Johnson took bronze in the men's doubles by beating Vasek Pospisil and Daniel Nestor of Canada 6-2 6-4.