Despite the wet and wild weather, Rio pulled out all the stops to put on an incredible Olympics closing ceremony.
The Maracanã Stadium was turned into a street carnival as the ceremony celebrated Brazil's art, music and dance.
The ceremony was watched by billions around the world.
Dancers perform during the 'Art of the People' segment, which paid tribute to local traditions.
The colourful ceremony lasted almost three hours.
Brazilian model Izabel Goulart led a parade of 50 women and 200 dancers.
Team GB celebrate after a hugely successful Olympic Games, in which they won 67 medals and took second place in the medal table.
The squad ensured they stood out from the crowd in special light-up shoes.
The Olympic flag is lowered inside the stadium.
The Olympic flame was extinguished by a rain shower, which then gave birth to a large tree sculpture to symbolise rebirth.
The ceremony included an official handover to 2020 hosts Tokyo.
One of the biggest cheers on the night came when Japan's Prime Miniser Shinzo Abe appeared dressed as computer game character Super Mario, rising out of a huge green pipe.
Governor of Tokyo Yuriko Koike accepts the Olympic flag on behalf of the city.
Rio closed the 2012 Games thanking everyone for their support.
Spectators, officials and athletes were then showered in confetti.
A huge fireworks display lit up the sky over the stadium.