RIO DE JANEIRO (AP) -- Fred scored two goals and Neymar added another as host Brazil convincingly defeated world champion Spain 3-0 to win the Confederations Cup on Sunday as protesters clashed with riot police outside the Maracana Stadium.

Fred put Brazil on the board less than two minutes into the match, Neymar added to the lead just before halftime and Fred netted his fifth goal in five matches early in the second half to give Brazil victory. The win for the host nation was surprisingly easy against the current world champion.

Sergio Ramos missed a penalty kick for Spain in the 55th, sending his low shot wide.

Advertisement

Spain defender Gerard Pique was sent off with a straight red card for fouling Neymar in the 68th.

Brazil came in hoping a victory would help it regain its status as a global powerhouse after recent struggles. Brazil was eliminated in the quarterfinals in the last two World Cups and hadn't won a significant title since the 2009 Confederations Cup in South Africa.

"The champion is back," chanted the crowd of more than 73,000 people at the renovated Maracana.

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."

The title gives Brazilian fans hope that the five-time world champions have a chance to win the World Cup title next year, although no Confederations Cup champion has ever won football's showcase event the following year.

"We beat the world champions today, but 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."

The Brazilian players huddled after the final whistle and started singing and jumping, then went toward the crowd near the sidelines and began celebrating. David Luiz kneeled down and raised both of his hands into the air.

The result ended Spain's 26-match unbeaten streak. It hadn't lost since a 1-0 result England in a friendly in London in 2011. Its last loss in an official competition had happened 29 matches ago, in the 2010 World Cup opener against Switzerland.

Spain badly wanted a victory against the five-time world champion, which was one of the few top teams it hadn't faced since it began dominating international football. Spain won the 2010 World Cup along with the 2008 and 2012 European Championships.

For Spain coach Vicente Del Bosque, the defeat was comprehensive. "There's not much to say, they were superior on every way. They scored early. This is not an excuse but they had pressure on us all the time."

It was "a deserved defeat," Del Bosque said.

It was the first time the traditional football nations had met since a scoreless friendly in 1999. The last competitive match between the teams had been Brazil's 1-0 win in the first round of the 1986 World Cup in Mexico.

Brazil scored early on Sunday and kept pressuring, but it didn't take long for Spain to start taking control of the match. The Europeans were not able to create many dangerous opportunities, though, while Brazil kept threatening the most while relying on counterattacks.

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, fired it in with his right foot while still on the ground.

Brazil added to the lead with Neymar's fourth goal in five matches after an exchange of passes with Oscar in the 44th. The newly signed Barcelona striker, touted as the future of Brazilian football, fired a powerful left-footed shot into the top of the net.

Neymar was voted the player of the tournament.

Neymar and Daniel Alves took the time after the match to congratulate their Barcelona teammates, who looked desolate across the field.

Fred closed the scoring in the 47th 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 had the penalty kick after Marcelo fouled Jesus Navas inside the area, but Sergio Ramos sent his kick wide.

Spain's greatest chance before the penalty came with Pedro Rodriguez in the 41st, when he entered the area clear from defenders in a breakaway. His low shot beat Brazil goalkeeper Julio Cesar, but David Luiz came rushing in and slid in front of the goal line just in time to keep the ball from going in.

Brazil won the its first Confederations Cup title in Saudi Arabia in 1997, then again in Germany in 2005 and in South Africa in 2009. Spain was trying to win the tournament for the first time.

Brazil struggled after Scolari returned to the national team earlier this year, winning only one of its first six matches with him in command, but it has won six in a row now.

The warm-up tournament, which gives the home country a chance to test its preparations for the World Cup, is played among continental champions plus the World Cup winner and the hosts.

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.