Peralta struck after just 30 seconds and the Mexican striker sealed one of the all-time great Olympic upsets when he scored again late in the second half.
Hulk got one back in stoppage-time but Mexico, playing in their first Olympic final, were deserved winners as Brazil once again failed to end their long wait for a first football gold.
Brazil, bronze medallists in Beijing in 2008, lost in the Olympic final in 1984 and 1988 and their failure to win gold has rankled with such a proud football nation for decades.
Photos: SRK does garba, Nawazuddin takes 'shower' in bathtub
Photos: Soha Ali Khan, Evelyn Sharma, Urvashi Rautela at Mumbai airport
Spotted: Lara Dutta, Mahesh Bhupathi with their daughter in Bandra
Photos: SRK, Tamannaah Bhatia, Varun Dhawan at Mehboob Studio
Birthday special: Sushant Singh Rajput's journey from TV to films