India struck early with two goals from Vivek Prasad but Malaysia responded with Akhimullah Anuar's brace and one goal each from Firadus Rosdi and Amirul Azahar to win the gold medal.
It was Malaysia's second-ever gold medal at the Youth Olympic Games after badminton starlet Goh Jin Wei won the country's maiden gold medal earlier at Buenos Aires 2018.
Two-goal hero Akhimullah also bagged an individual honour as he finished as the top scorer with 22 goals, nine more than nearest rival Philimon Bwali of Zambia.
In the pool stage, Malaysia qualified for the quarter-finals in second place after beating Vanuatu 14-0, Mexico 4-2, Zambia 7-2 and Poland 4-3, despite losing 2-4 to Pool A winners Argentina.
They then overcame Austria 2-0 in the quarters and recorded a 7-4 semi-final win over Zambia.
In the bronze medal match, Zambia, who pulled off a giant-killing act over two-time defending champions Australia in the quarter-finals, were unable to do the same against Argentina and lost 0-4.
Meanwhile, in the girls' tournament, Argentina beat India 3-1 to win the gold medal, while China won bronze by recording a 6-0 win over China.
Congratulations! #Malaysia ?? won the gold medal in the men's #hockey5 tournament at #BuenosAires2018 in an exciting final versus #India ??!— Olympic Channel (@olympicchannel) October 15, 2018
Follow the @youtholympics on the Olympic Channel ? https://t.co/vfUYIV4Qc8@hockeymalaysia @FIH_Hockey pic.twitter.com/8iK85wy2FD