His younger brother Jonny won silver in the gruelling three-discipline event which took place on the Copacabana.
Henri Schoeman of South Africa won bronze.
Alistair Brownlee is the first man to retain an Olympic triathlon title.
Jonny won bronze in London but upgraded to silver in Rio.
Alistair and Jonny led the way in the running, with the older sibling pulling away with just over a lap of the final discipline to go.
The brothers’ British team-mate withdrew after crashing on his bike.
The triathlon begins with open water swimming, before the competitors move on to cycling and finish with a run.