Brazil needed an extra-time winner from Malcom to claim Olympic gold with a 2-1 win over Spain on Saturday.
The game headed into extra-time when Mikel Oyarzabal ruled out Matheus Cunha's opener but former Barcelona man Malcom scored after 109 minutes to seal the win for Brazil.
- Men's Olympics soccer bracket and fixtures
Brazil are the first nation to retain their Olympic crown since rivals Argentina won consecutive gold medals in 2004 and 2008.
Brazil claimed their first ever Olympic gold in men's football in Rio 2016 when Neymar scored the winning penalty in the shootout against Germany.
Spain have to settle for the silver medal and have now failed to win the event since they hosted the Olympic Games in 1992.
A tense first-half came to life after 42 minutes when Brazil were awarded a penalty after VAR adjusted Spain goalkeeper Unai Simon to have fouled Cunha inside the box.
However, Richarlison stepped up to take the spot kick but blazed it over the crossbar.
Brazil took the lead minutes later when Cunha took down Dani Alves' looping cross inside the box and produced a composed finish into the corner.
Brazil almost made it 2-0 six minutes after the break but Richarlison's close-range effort was saved onto the bar by Simon.
Spain made Brazil rue that missed chance and equalised after 61 minutes when Oyarzabal volleyed home from Carlos Soler's cross.
Spain almost grabbed a winner but Soler and new Tottenham signing Bryan Gil both rattled the crossbar before the end of normal time.
Brazil were the more positive side and were rewarded for their attacking display in the second half of extra-time when Malcom finished off a stunning counterattack.