Sun Yang became the first Chinese male swimmer to earn gold as he won the 400m freestyle with an Olympic record.
Sun overhauled South Korean rival Park Tae-hwan, who had been reinstated into the final after being disqualified for a false start in his morning heat.
Defending champion Park had led for most of the race before Sun overtook him just after the final turn and went on to win.
Peter Vanderkaay was third, with Great Britain's David Carry, 30, in seventh.
Carry is the oldest member of Team GB's swimming squad and said: "What a feeling. I can't believe it.
"A year ago I set myself the target of reaching the Olympic final. There have been some rocky patches. To have this awesome support behind me was fantastic."
Sun was on world record pace in the final 50 metres and, although he narrowly missed out on that mark, he did break Australian swimmer Ian Thorpe's Olympic record.