Serbia's players celebrate after beating Spain to win the gold medal in men's water polo at the FINA Swimming World Championships in Rome on Saturday. ((Andrew Medichini/Associated Press))

Serbia has won a dramatic shootout at the world championships, claiming the gold medal in men's water polo 14-13 over Spain.

Xavier Garcia scored for Spain with 11 seconds left in regulation to tie the game at six. Spain's Guillermo Molina and Serbia's Nikola Radjen matched goals in extra time to make it 7-7.

Then it was on to the penalty shootout, which went extra time as well.

The teams were still tied, 10-10, after five shots apiece, and it took four more rounds before Serbian goalie Slobodan Soro blocked a low shot by Blai Mallarach and Milan Aleksic won it by rifling one past the right arm of Spanish netminder Inaki Aguilar.

"This is a great victory for us," said Vanja Udovicic, who led Serbia with five goals. "It means a lot because we are back on top of the world."

The Serbian fans set off flares in the stands as the players and coaches hopped in the pool to celebrate after Aleksic won the country's first title since 2005, when it was still aligned with Montenegro. Both countries were once part of Yugoslavia, which won back-to-back titles in 1986 and 1991 before splitting up.

Spain lost despite getting seven goals from Garcia.

"I cannot think of something that we did wrong tonight," Spain coach Rafael Aguilar said. "We did everything very well. We made a very big effort. My players couldn't do more than this."

Serbia's Filip Filipovic scored four times.

The Serbians bounced back after losing to Spain 18-17 on penalties for the bronze medal match at Melbourne two years ago, then falling 11-9 in the opening game of this tournament.

"This victory over them is good revenge," Serbia coach Dejan Udovicic said. "We are world champions!"

Earlier, Croatia defeated the United States 8-6 to win bronze.