The United States Dream Team of NBA stars captured their second successive Olympic men's basketball gold medal and the 14th overall for America by beating Spain 107-100 in Sunday's final.
Running unbeaten through the tournament as they did in 2008 when they also beat Spain in the final, the US multi-millionaire lineup of NBA elite claimed their fifth crown in the past six Olympics.
"I'm on cloud nine. It's such a huge honour," US star Kobe Bryant said after his final Olympic bow.
"It's hard work and perseverance. I feel very fortunate to go to the Olympics twice and give it a go. I feel very lucky. It was nice."
The Americans improved to 62-1 since revamping the national team program after settling for Olympic bronze in 2004.
"It's a relief because if we don't come back winners it's a disaster," US assistant coach Mike D'Antoni said.
But reigning European champion Spain, routed by the US NBA stars in a pre-Olympic exhibition game last month in Barcelona, stayed with the defending champions to the very end, keeping within reach until the final minutes.
"We didn't want it to be easy," US star LeBron James said. "When it gets tight, our will and determination shines."
Kevin Durant led the US stars with 30 points while James had 19 and Bryant added 17.
Pau Gasol, Bryant's NBA Los Angeles Lakers' teammate, led Spain with 24 points while Juan-Carlos Navarro added 21 and Rudy Fernandez contributed 14.
Spain's only Olympic medals in the event have come with finals losses to US teams in 1984, 2008 and in London.
"It's a disappointing loss," Spanish NBA big man Gasol said. "Very proud of the way we competed. We fought. It's disappointing on one side because we couldn't reach the goal, because we had ou r chances.
"We were there pretty much the entire game, but we let them get away in the fourth and we couldn't come back."
The Americans led 83-82 entering the fourth quarter and opened a 12-3 run early in the period, Chris Paul scoring the first five points while Bryant had four.
Navarro hit a jumper and Fernandez added a tip-in to pull Spain within 97-91 but James answered with a slam dunk and followed a Marc Gasol dunk with a 3-pointer to put the Americans ahead 102-93 with 1:59 remaining.
US players began celebrating with hugs when James and others were pulled from the court with 37 seconds to play and late free throws sealed the triumph.
"Today was a dogfight," US veteran Carmelo Anthony said.
Spain used a new defensive scheme and for a time kept the explosive US offence contained, fading only at the finish.
"We didn't have a lot of practice on it and it didn't work at times," he said.
"The US are an amazing team. We were close at times but we couldn't play the perfect game we needed to beat them.
"It's a bittersweet feeling. We were close again against this team of excellent players. You have to have pretty much a perfect game to be able to beat them. I'm proud of our spirit and how close we were."
In the end, the Americans were celebrating with hugs and chest bumps and players walked off waving US flags, but in the chaos, Bryant found Pau Gasol to give his sympathy to his NBA teammate.
"It was a tough moment for me and Kobe came over to congratulate me," Gasol said. "He gave me a hug and told me to get some rest now and to get ready for the season. It was a great gesture from him."
US players pose with their gold medals after winning the London 2012 Olympic Games men's basketball competition at the North Greenwich Arena in London.
Serge Ibaka (R) of Spain defends against LeBron James (L) of the US during the London 2012 Olympic Games men's gold medal basketball game between USA and Spain at the North Greenwich Arena in London.
US players listen to their national anthem on the podium after winning the gold medal in the London 2012 Olympic Games men's basketball competition at the North Greenwich Arena in London. The US won the gold medal followed by the silver to Spain and the bronze to Russia.
US gold medalists LeBron James and US forward Kevin Durant (L) pose on the podium after the London 2012 Olympic Games men's gold medal basketball game between USA and Spain at the North Greenwich Arena in London. The United States Dream Team of NBA stars captured their second successive Olympic men's basketball gold medal and the 14th overall for America by beating Spain 107-100.