Andrija Prlainovic scored five times to lead a relentless Serbian attack, while goalkeeper Slobodan Sporo made a string of big saves to deny the Hungarians. Hungary came in on a 17-match Olympic unbeaten streak dating back to Sydney in 2000.
"It was not easy," Serbia's Filip Filipovic said. "They are triple Olympic medallists , so we maybe expected a little bit more aggression from their side and expected maybe a tougher game in defence and offence."
The victory puts Serbia on top of Group B along with the United States, which edged Montenegro 8-7, and Romania, which crushed Britain 13-4.
Filipovic, the 2011 world player of the year, Dusko Pijetlovic and Slobodan Nikic chipped in with two goals apiece for the Serbs, who blew open a close game with five unanswered goals to take an 8-3 lead halfway through the third quarter.
Hungary, aiming for an unprecedented fourth consecutive water polo gold medal, tried to battle back, but the deficit proved too much against a loaded Serbian side in an extremely physical contest in front of a sold-out water polo arena.
"We lost against a very good team," said Hungary's Tamas Kasas. "We played bad, they played really good, and our defence was unfortunately not present, not good at all. But the tournament is very long, so we will have time."
Kasas, who is one of four triple gold medallists on Hungary's team, brushed aside talk of disappointment with the unbeaten streak coming to a halt.
"I don't care about records," he said. "We just want to win the next game and not think about history and records, because if you think about this you can't concentrate on the next match."
Hungary goalkeeper Zoltan Szcesi, who was kept busy throughout the match, gave Serbia credit for the win, but said defensive lapses and a lack of focus ruined Hungary's chances.
"Everybody can play well if we let them," he said.
While the Hungarians have won a record nine Olympic water polo golds, the Serbs are still in search of their first as an independent nation. They won three golds as part of Yugoslavia before the country's collapse.
The U.S. opened its Olympic campaign with a hard-fought win over Montenegro behind three goals from Peter Varellas. The U.S. is looking to improve on its second-place finish in Beijing in 2008 and win the Americans' first water polo gold since 1904.
"There really aren't going to be any easy games, but we knew that if we could put away one of these strong teams early, hopefully we could feel a little more comfortable in the tournament," Varellas said.
Earlier Sunday in Group A, Croatia used a late surge to pull away for an 8-6 win over Greece. With the score 5-5 after three quarters, Croatia netted three unanswered goals from Niksa Dobud, Miho Boskovic and Sandro Sukno to take control of the match.
"It was a bit nervous start for us, the first two quarters, and after we started to play more aggressively, our quality came to give us the result," Boskovic said.
Spain opened its Olympic campaign in Group A with an easy 14-6 victory over Kazakhstan behind five goals from Filipe Perrone Rocha, while Alex Giorgetti scored twice to lead 2011 world champion Italy past Australia 8-5.
"It was amazing. We feel like we were flying in the water," Spain's Rocha said. "To score five goals is perfect, but the most important thing is that we were playing amazing and that we beat Kazakhstan."
The 12-team field is broken into two groups of six for the preliminary stage, and the top four teams from each group advance to the knockout round.
Ryan Lucas can be reached on Twitter at www.twitter.com/relucasz.