The Americans had their hands full with Spain in the title game for the second Olympics in a row, but the three key U.S. players -- Durant, James and Kobe Bryant -- came through down the stretch.
James, playing with four fouls, returned to the game in the fourth period and took charge during a critical stretch as the Americans were edging in front.
His 3-pointer with 1:59 to play was the biggest shot of the game, one that gave the United States a 102-93 lead and put Spain in desperation mode.
James, Bryant and Durant all left the game with 37 seconds to play and each received a long hug from U.S. and Duke Blue Devils Coach Mike Krzyzewski.
"We beat a great team to win this gold medal," Krzyzewski said.
It was the fifth Olympic gold medal for the U.S. men's basketball team in the last six Games.
In Beijing the Spanish were within two points midway through the fourth quarter before a late run left the Americans with a 118-107 victory.
This time Spain overcame an early nine-point deficit and took a brief lead in the second half. The American advantage was just one going into the fourth quarter, but James scored the first basket of the quarter and 3-pointers from Durant and Chris Paul helped create some breathing room over the first 2:10 of the period.
Durant hit 5-of-13 from 3-point range and was 9-of-10 from the foul line in producing his 30 points. James added 19 points and Bryant had 17. Bryant's long-time Los Angeles Lakers teammate Pau Gasol led Spain with 24 points.
"Pau is as great a player as there is internationally," Krzyzewski said. "They are a great team."
The game was physical throughout with 54 fouls being called -- 27 on each side. There were 63 free throws shot with the Americans making 24-of-31. The United States shot 48 percent from the field and took more shots from outside the 3-point line (37) as it did from inside (33).
Bryant made half of his 10 shots from the field and then said he had played his last Olympic contest.
"This is it for me," Bryant said. "Maybe some of these young guys will be in Rio (for the 2016 Games). Maybe I will go watch."
Chipotle plans first price increase in 3 years
Justin Bieber crashes Drake Bell's album release party