AP Sports Writer
BELO HORIZONTE, Brazil (AP) -- Brazil's players wept with joy inside the stadium, and Brazilian protesters were sprayed with tear gas outside it as the country's soccer team reached the Confederations Cup final despite another wave of mass demonstrations on the streets.
Brazil beat neighbor Uruguay 2-1 on an 86th-minute header from Paulinho. The hosts, seeking their third straight Confederations Cup title, will play the winner of Thursday's semifinal between World Cup-European champion Spain and Italy.
The championship game is Sunday and protests already have been announced for Maracana Stadium.
As thousands of anti-government protesters clashed with police nearby, inside Mineirao Stadium, Brazil was inconsistent, but good enough.
"It's a new team and this is going to help us grow for the World Cup," Brazil goalkeeper Julio Cesar said. "We know that we can face a very difficult opponent (and win)."
Diego Forlan could have put Uruguay ahead in the 14th minute, but Julio Cesar dived to his left to stop Forlan's low penalty kick after Brazilian defender David Luiz was called for tugging the shirt of Diego Lugano. Only four of eight penalties kicks in the tournament have been successful.
Brazil took the lead in the 41st. Neymar brought down Paulinho's high ball, and goalkeeper Fernando Muslera saved Neymar's attempt. The loose ball trickled across the penalty area, and Fred scored despite scuffing his shot.
Edinson Cavani took advantage of sloppy defending to tie the score three minutes into the second half, intercepting Thiago Silva's pass to Marcelo after a poor clearance by David Luiz.
Paulinho scored the winning goal when he got away from Martin Caceres at the back post and beat Muslera from 4 yards with an open header after the goalkeeper came off his line.
"We are not ready yet," Brazil coach Luiz Felipe Scolari said. "We have to go through this, through all these situations so we can grow and evolve ... and reach the World Cup in better shape.
"What I have to show them is the progress that they made. This is how I make them self-confident."
Outside the stadium, protesters' anger was directed at the government and police. Inside, the animosity was directed from the start at Lugano, the Uruguay captain who enraged Brazilian fans on the eve of the match by accusing Neymar of diving.
Slack defending helped Uruguay as several chances to clear the ball out of danger were wasted. Thiago Silva's pass to Marcelo was easily intercepted by Cavani, who scored past Cesar.
However shoddy the work of Brazil's defenders, the quality of the forwards started to shine through as the game became feisty, with five yellow cards awarded. Neymar exchanged taunts with Uruguay's Alvaro Gonzalez before sarcastically blowing him a kiss.
But Neymar helped ensure Brazil had the last say as he floated a corner kick into the penalty area that Paulinho rose above Caceres to meet and head into the net.
"It was an even match, maybe we even had more chances than Brazil, but football is like this," Uruguay striker Luis Suarez said. "In the end, they found a way to win."
Security was high at the semifinal as protesters, in part angered by the billions of dollars spent on World Cup preparations, targeted this high-profile match in the latest in a series of demonstrations in Brazil during the tournament. They were met by tear gas and rubber bullets during clashes with police, but the match itself was unaffected by the protests.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.