Szilagyi is the only Hungarian fencer in the world's top 50 - he is ranked sixth - and was the country's only representative in the 36-strong field.
He was also one of the youngest taking part, but after four earlier wins he easily beat Italian Diego Occhiuzzi 15-8 in the final.
Bronze went to Russian Nikolay Kovalev, who had beaten German world number one Nicolas Limbach in the quarter-finals.
Kovalev beat Romanian Rares Dumitrescu to claim third place.
Occhiuzzi found himself 7-0 behind in no time at all, fought back to 9-5 and 12-7, but Szilagyi was simply in unstoppable mood as he became his country's first winner of the title since Bence Szabo at Barcelona 1992.
The competition was full of shocks, with none of the world's top five or the last two winners of the title reaching the semi-finals.