Brazil scraped into the final of the Confederations Cup with victory in an emotional and highly-charged encounter at the Estadio Mineirao.
Paulinho's late header ensured the Selecao finally saw off a resilient Uruguay to set up a clash with Spain or Italy in the Maracana in Rio de Janeiro on Sunday.
Fred had given Brazil a scarcely-deserved first-half lead, prodding home Neymar's cross. But Uruguay hit back shortly after the interval when Edinson Cavani capitalised on an error from Brazil captain Thiago Silva to strike a low shot beyond Julio Cesar.
"Brazil just got themselves over the line but it was a performance that needs a lot of questions asking about it. I'm sure they will be asked over the next few days. They were not at their best but Sunday is a different day. They might even be loaned the ball by Spain if they get to the final."
Home goalkeeper Cesar had earlier saved Diego Forlan's first-half penalty, after David Luiz pulled down Uruguay captain Diego Lugano.
This was a test of character and spirit for Luiz Felipe Scolari's Brazil but the jubilation among the players and coaching staff at the final whistle showed just how much this meant. Brazil never approached their fluent best but they did just enough to get over the line.
The build-up had been every bit as passionate and spiky as the game itself. Cesar had described the rivalry between the nations as more intense than that of Brazil's with Argentina, while
Uruguay captain Diego Lugano had accused Neymar of attempting to fool referees by diving.
But for all the talk, on both sides, of a fiesta of South American football, the match was fraught and fractious. Neither side found their fluency, as Uruguay drained the game of pace and momentum, quietening the crowd and adding to the mood of tension around the ground.
But it was an incident in the 14th minute, involving two players who had featured in the build-up, that changed the mood. Uruguay won a corner and as the players jostled in the penalty area, Luiz grabbed a handful of Lugano's shirt and the Uruguay captain went to ground for a penalty.
Paulinho's winner earned Brazil their 11th straight Confederations Cup win - a tournament record.
The Brazil players surrounded Chilean referee Enrique Osses and the stadium erupted in fury. Forlan was made to wait and wait to take the spot-kick and his effort was low and tame, allowing Cesar to dive to his left and turn the ball behind with a flick of his glove.
The noise that rumbled around the Estadio Mineirao initially appeared to shake Brazil from their slumber. And yet for the remainder of the half, they looked a side lacking cohesion, confidence and sustained threat - insipid not inventive.
Uruguay continued to threaten, frustrating Brazil, snapping in tackles and denying them space. Rodriguez headed just over while Forlan fizzed a curling left foot shot just wide.
It seemed it might take a mistake, some individualism or a piece of good fortune to break the deadlock and give Brazil hope - so it proved.
With half-time in sight, Paulinho's lofted pass spun perfectly into the path of Neymar. He forced the ball back across goal, but it was deflected into the path of Fred, via a deflection off Lugano, allowing the local boy to force the ball into the net with his shin.
Did you know?
Brazil beat Uruguay 3-0 at the Estadio Mineirao in September 1965. It was the first international played at the venue.
And yet Brazil were still prone to lapses in concentration. With the second half just minutes old, their captain Thiago Silva ended a calamitous series of errors by passing the ball to Cavani in the penalty area. The highly-rated Napoli striker fired a low shot beyond Cesar before many Brazilians had taken their seats, to level the game and stun Estadio Mineirao into silence for a second time.
The introduction of home-town hero Bernard lifted the home crowd once more. His quick feet took him past two Uruguay defenders within minutes of his arrival only for Fred to fire high and wide when the ball finally came his way.
Uruguay dropped deeper and deeper as Brazil went to the flanks in search of an opening. Cavani, though, still threatened. One shot deflected narrowly wide, but with time running out it was the hosts who struck the decisive blow. Neymar floated a corner over from the left and Paulinho rose highest to head in at the far post and spark scenes of jubilation.
Brazil coach Luiz Felipe Scolari:
"If you keep plugging away something good will happen and that happened today.
"Four wins in four games is important. We are on the right track."
Uruguay manager Oscar Tabarez:
"More than having an effect on my team, the penalty miss had a huge effect on the opponent.
"They had been second best until then and from that moment they grew."
- 12 Julio Cesar
- 02 Alves
- 03 Thiago Silva
- 04 Luiz Booked
- 06 Marcelo Booked
- 11 Oscar (Hernanes - 72' )
- 17 Dias Booked
- 18 Paulinho
- 09 Fred
- 10 Neymar (Dante - 90' )
- 19 Hulk (Bernard - 64' )
- 01 Jefferson
- 22 Cavalieri
- 13 Dante
- 14 Filipe
- 16 Rever
- 05 Fernando
- 07 Lucas Moura
- 08 Hernanes
- 15 Jean
- 20 Bernard
- 23 Jadson
- 21 Jo
- 01 Muslera
- 02 Lugano
- 03 Godin
- 16 Pereira
- 22 Caceres
- 07 Rodriguez
- 17 Arevalo
- 20 Gonzalez Booked (Gargano - 83' )
- 09 Suarez
- 10 Forlan
- 21 Cavani Booked
- 12 Castillo
- 23 Silva
- 04 Coates
- 13 Aguirregaray
- 05 Gargano
- 06 Pereira
- 08 Eguren
- 14 Lodeiro
- 15 Perez
- 18 Ramirez
- 11 Hernandez
Ref: Enrique Osses