RIO DE JANEIRO —
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 coach Luiz Felipe 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.