To some analysts, it was a no brainer. The veteran Spanish team had a leg up on the young Brazilian team. Some were already saying a loss would help Brazil next year.
But the crowd at Maracana Stadium was noisy, hoping for and anticipating a triumph by Brazil.
The Selecao rewarded the fans with a comprehensive victory over the best national team of the 21st century, an ego-boosting 3-0 smothering of world champion Spain in the Confederations Cup final on Sunday night.
But Brazil is focusing on the really big prize: the World Cup that it hosts next year.
"We know that the tournament that we will be playing next year will be a lot more difficult," Brazil coach Luiz Felipe Scolari said. "Now we have more confidence. That's what we needed."
In the stadium that will host the 2014 World Cup final next July 14, Fred put Brazil ahead in the second minute, Neymar doubled the lead in the 44th with his fourth goal of the tournament and Fred added his fifth in the 47th. While there was a crowd of 73,000 in the renovated stadium, outside protesters clashed with riot police on the final night of the two-week prep tournament.
"Brazil has shown to the world that this is the Brazilian national team and that we must be respected," said 21-year-old Neymar, awarded the Golden Ball as the tournament's top player. "I think that today we had a great victory against the best team of the world, with some of the best players in the world."
In a matchup of new and old powers, the five-time world champion defeated the reigning world and European champion and ended Spain's 29-game, three-year winning streak in competitive matches. Spain lost a competitive game by three goals for the first time since a 3-0 defeat at Wales in a World Cup qualifier in April 1985.
"We are happy with what we have done over the last few years," Spain coach Vicente Del Bosque said. "But one loss — you have to look at it, but not overreact to it. We are not content with the loss. But when a team is superior, you have to accept it. It was a deserved defeat."
Brazil won its third straight Confederations Cup, and is unbeaten in 57 consecutive home competitive matches since 1975. Yet, no reigning Confed Cup winner has gone on to capture the following year's World Cup.
Spain, which had not lost a competitive game since its 2010 World Cup opener against Switzerland, had a miserable night. Sergio Ramos sent a penalty kick wide in the 55th and defender Gerard Pique was ejected by Dutch referee Bjorn Kuipers with a straight red card for fouling Neymar in the 68th.
"The first minutes and the last minutes of the halves are critical," Spanish defender Cesar Azpilicueta said. "And they scored their three goals at the beginning and ends of the halves, which is the worst time. Those are the most demoralizing moments."
Eliminated in the quarterfinals of the last two World Cups, the Selecao entered the tournament having not played a competitive match since the 2011 Copa America. Brazil had slipped to 22nd in the FIFA rankings, between Ghana and Mali.
Spain, ranked first for the past 20 months, is the most accomplished national team of recent decades, winning its first World Cup in 2010 between titles in the 2008 and 2012 European Championships.
But in the stadium where 170,000-plus watched Brazil lose to Uruguay in the last game of the 1950 World Cup, Brazil dominated La Furia Roja.
"The champion is back," the crowd chanted.
It also didn't take long before the fans — in a sea of yellow jerseys — started teasing the Spaniards, chanting "Wanna play, wanna play!? Brazil will teach you."
Spain had been unbeaten in 26 matches overall, including friendlies, since a 1-0 loss to England in London in 2011 and had outscored opponents 69-11 in competitive matches since the loss to Switzerland in South Africa.
But Spain had not played Brazil since a 1999 exhibition, and they hadn't met in a competitive match since the Selecao's 1-0 win in the first round of the 1986 World Cup in Mexico.
"We knew we were going to encounter a physical game with lots of fouling," Spanish midfielder Andres Iniesta said. "We lost to a very strong team, and the small details let us down."
Fred opened the scoring after a cross into the area by Hulk in the second minute. The ball bounced off Neymar near the far post and Fred, who had fallen while trying to reach for the cross, shot with his right foot while still on the ground.
Brazil added to the lead after Neymar exchanged passes with Oscar and then sent a powerful left-footed shot over goalkeeper Iker Casillas.
Fred got the final goal from just inside the area, sending a low shot to the far corner. Hulk started the move with a pass to Neymar, but the striker let it go as Fred came running behind him.
Spain was awarded the penalty kick after Marcelo fouled Jesus Navas inside the area. Ramos, who skied a penalty kick for Real Madrid against Bayern Munich in the 2012 Champions League semifinals, sent this one wide.
Spain's best chance before the penalty came with Pedro Rodriguez in the 41st, when he entered the area clear from defenders on a breakaway. His low shot beat goalkeeper Julio Cesar, but David Luiz came rushing in and slid in front of the goal line just in time to deflect the ball over the crossbar.
There were protests outside the stadium during the match, with police using rubber bullets and tear gas to keep demonstrators from getting too close. A wave of anti-government protests has swept across Brazil in recent weeks, and many affected the Confederations Cup host cities as demonstrators complained of the costs of hosting the World Cup.
On the field, it was a heated match from the start, with players from both teams pushing and shoving each other a few times. Even the substitutes got into a shouting match.
"We played a very good match," Scolari said. "It allows us to have a better idea about the path ahead of us."
Based on reporting by The Associated Press.