With his back to the goal, Spain's Ivan Perez Vargas whipped off a shot just before the horn that appeared to cross the line and level the game at 8-8. The line judge called it a goal, but match referee Boris Margeta of Slovenia overruled him, giving Croatia the 8-7 victory.
Spain has appealed the decision to the FINA technical committee.
"I was close by and I saw that it was a goal. I even celebrated it, and I could see on the TV that it was a goal," Perez Vargas said. "I feel frustrated because it's a decision that is a big prejudice against us, and it's not fair. It's really sad to know that in the 21st century they're not using the technology to check this."
Spain coach Rafael Aguilar Morillo ran around the pool to appeal to Margeta, pointing at the jumbo screen in the venue that was showing replays of the shot. As he pleaded for the referee to change his decision, the crowd of some 5,000 at the water polo venue chanted "goal, goal" and "Espana, Espana."
"He should have consulted the line judge, who actually said that it was a goal," Aguilar Morillo said. "But he didn't. In the Olympic Games, the judges are only there to see that line, and in this case the line judge wasn't even consulted."
If the win stands, Croatia will have four points from two matches, and sit atop Group A, with Spain two points behind.
Italy, the 2011 world champions, moved into second place in the group with three points after earning a 7-7 draw against Greece. Australia, meanwhile, is even with Spain following its victory against winless Kazakhstan.
In Group B, Montenegro goalkeeper Milos Scepanovic denied Denes Varga's close-range shot as the buzzer sounded to preserve the team's win over Hungary in a tight, physical contest between two medal contenders.
The Hungarians also dropped their opening match to gold medal-favourite Serbia, which was the country's first loss in men's water polo since the 2000 Sydney Games — a streak of 17 matches.
For Montenegro, which holds legitimate medal hopes in London, Tuesday's win provided a boost following the team's 8-7 loss to the United States in their Olympic opener.
"It was a really bad day against the Americans, and today we showed that we're a true team and that's the most important thing," said Montenegro's Drasko Brugljan. "It's very important to win our first game, and this performance is the recipe for our next matches."
With the victory, Montenegro earned two points in a tight Group B.
Serbia staked its place atop the group with four points, crushing Britain 21-7 with Prince William watching from the stands at a packed water polo arena, while the United States stayed perfect with a 10-8 win over Romania behind three goals apiece from Ryan Bailey and Peter Varellas.
Hungary, meanwhile, has no points from its opening two games, and sits at the bottom of the group.
Still, Tamas Kasas, who is appearing in his fifth Olympics, took heart from the team's performance against Montenegro.
"We lost again, but the difference was enormous between the first game and the second game," the Hungary veteran defender said. "In the first one, our heart we left in the hotel, in the village, and this time we were all there and we played like a really good team. We made many mistakes but I see many positive things today in this loss. So I think we are on the right road."
The 12-team field in London is broken down 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