BARCELONA, Spain (AP) — Hungary edged Montenegro 8-7 Saturday to claim its third world title in men's water polo.

Hungary never trailed but needed Marton Szivos' goal with less than two minutes to play and a save by goalkeeper Viktor Nagy in the final seconds to ensure the gold medal.

Hungary's previous two gold medals at the world championships came in 1973 and then in 2003 at this same Bernat Picornell pool in Barcelona.

The silver was Montenegro's first medal in men's water polo competing as an independent nation after gaining independence from Serbia in 2006. In 2005, competing as Serbia and Montenegro, it beat Hungary for the gold.

Earlier, Croatia claimed the bronze by defeating Italy 10-8.