The world number one becomes the first man to defend the title.
Lee charged out of the blocks to raise Malaysian hopes of a first ever Olympic gold medal but Lin dug deep for a 15-21 21-10 21-19 victory in a 79-minute classic, denying his long-time rival in their second successive Olympic final.
World number one Lin had trounced Lee to win an emotional gold medal on his home court in Beijing four years ago, but today he had to survive withering pressure from the Malaysian in the frenetic atmosphere of Wembley Arena.
In the deciding game, Lee lost the final point when he pushed a lob past the baseline, sending Lin into a frenzy and giving China their fourth badminton gold medal of the Games.
Shortly after Lin Dan had defeated Chong Wei, the pairing of Cai and Fu beat Denmark’s Mathias Boe and Carsten Mogensen, giving China an unprecedented sweep of all five Olympic badminton gold medals.