Scott had been pipped for gold by 0.04 seconds by Tom Dean in the 200m individual freestyle on Tuesday but teamed up with the Bath swimmer, James Guy and Matt Richards to triumph in the relay.
It’s Glasgow-born Scott’s first Olympic gold after three silver medals, including two from Rio 2016.
Team GB’s time of six minutes and 58.58 seconds set a new European benchmark and was just three hundredths of a second behind the world record still held by a Michael Phelps and Ryan Lochte inspired United States 12 years ago.
Scott, 24, from Glasgow, said: “For myself and Jimmy [James Guy] in particular, we’ve been on so many 4x200m freestyle squads together, we’ve been able to win Worlds, Europeans.
“In 2016, we were able to come second, that was a monster achievement at the time but that was jut really special with these boys.
“Matt on the third leg was so composed and those boys [Tom Dean and James Guy] executed their race plans really well.
“It was so close to a world record – if anything, I’m a bit gutted!”
Dean led the team out, touching third at the end of his 200m, before Guy overhauled the swimmers in front to put Team GB in the lead and 18-year-old Richards – who pulled out of the individual 100m freestyle event to focus on the relay – maintained the advantage.
That gave Scott an anchor-leg lead that he never looked likely to relinquish, finally securing that elusive gold when he touched for a European record time of 6:58.58.
Finishing ahead of the Russian Olympic Committee and Australia, the British quartet were within a whisker of the world record.
The win means that Dean has become the first British male swimmer to win more than one gold medal at a single Games since 1908.
Dean, who revealed he has had coronavirus twice inside the past year, said: “It feels pretty special. Double Olympic champion sounds pretty good. The last 24 hours have been unreal, a complete whirlwind.”