A towering Paulinho header saw Brazil edge Uruguay 2-1 on Wednesday in an ill-tempered Confederations Cup semi-final in Belo Horizonte to set up a final with either world champions Spain or Italy.
Fred scored from close range two minutes from half-time to calm the nerves of the
five-time world champions and Confederations Cup title holders after Diego Forlan had first missed a penalty for Uruguay.
But Edinson Cavani levelled three minutes after the restart and thereafter the hosts were rocking before Paulinho rose high to plant a firm close-range header past Fernando Muslera in the Uruguay goal to pull off a barely deserved victory.
"A Brazil match against Uruguay is always really an emotional rollercoaster for me," said Julio Cesar, who said he knew Forlan would fire his penalty to his left.
"I played with him at Inter Milan - but it was a good stop."
Cavani said the penalty miss was "a shame as we were playing well but we have to take it on the chin."
Uruguay coach Oscar Tabarez, who led Uruguay to the Copa America title in 2011 to book a berth here, was sanguine afterwards.
"We played with passion and made it tough for them. But we will learn from the experience," Tabarez said.
Matches between the South American neighbours have long been tense affairs - not least since the Uruguayans shocked the Brazilians in the 1950 World Cup final in Rio to deny their hosts a first title.
But what gave this meeting added spice were pre-match comments by Uruguayan skipper Diego Lugano labelling Brazilian starlet Neymar a diver.
The Brazilian Football Confederation (CBF) issued a furious rebuttal of the claim, but there was clearly no love lost between the sides as they snapped into tackles and scrapped for every bit of territory.
Brazil made a sluggish start and Lugano was to the fore as he won a penalty for the Uruguayans after 16 minutes.
The veteran defender tussled with Chelsea centreback David Luiz in the box and went down - but Chilean referee Enrique Osses quickly spotted that Luiz had tugged on his rival's shirt and gave the spotkick.
Uruguay's record goalscorer Forlan stepped forward but placed his low kick too close to Julio Cesar, the Brazilian keeper diving away to his left to push the ball round the post and elicit a deafening cheer from a 60,000 crowd at the Estadio Mineirao.
Around twice that number were in the streets, kept out by a police cordon as they joined yet another protest against crumbling public services and government corruption as well as the multibillion dollar bill for staging major sporting events.
Police said beforehand they expected trouble but Brazil, mindful of coach Luiz Felipe Scolari's urging them to make their countrymen proud, finally awoke from their nervy slumbers and took the lead two minutes before the break with their first chance of note.
Neymar chased a long punt down the left and stretched to flick the ball across goal for Fred to poke home a scissor kick finish from the edge of the six yard box, sparking pandemonium in the crowd.
By then, Neymar had certainly spent some time on his back - yet the Barcelona-bound 21-year-old was a marked man as Cavani earned a booking for yanking him back.
Yet Brazil were still nowhere near to finding the flowing form which had brought three wins and nine goals in the group stage and three minutes after the restart Uruguay were level through Cavani, the Napoli man threading a left-foot strike past Cesar.
Some dreadful defending saw the hosts fail to clear their lines as Luiz, Thiago Silva and Luiz Gustavo lost their bearings and Cavani drilled in hard and low to stun the home support.
Forlan then had a half-chance to atone for his earlier faux pas but fired straight at Cesar.
Scolari reacted to an increasingly leaden showing taking off Hulk, replacing him with local favourite Bernard.
Scolari also took off Oscar and sent on Hernanes in an attempt to inject some fresh drive.
Yet it was Uruguay who were turning the screw with first Luis Suarez heading fractionally over from a Forlan cross on 73 minutes before Cavani turned Hernanes inside out and slid an effort just wide as the Uruguayans attacking trident almost embarrassed a shaky home back four.
But with four minutes remaining Neymar whipped over a corner from the left and Paulinho outjumped Martin Caceres and seal their place in the final.
© Copyright © 2013 HT Media Limited. All Rights Reserved.