Belo Horizonte: A towering Paulinho header saw Brazil edge out Uruguay 2-1 on Wednesday in an ill-tempered Confederations Cup semifinal 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 home nerves for the five-time world champions and Confederations title holders after Diego Forlan had first missed a penalty for Uruguay.
But Edinson Cavani pulled a poachers strike out of the bag three minutes after the restart and thereafter the Samba stars were rocking before Paulinho rose high to plant a firm close-range header past Fernando Muslera in the Uruguay goal to cement a barely deserved victory.
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 as both nations limber up for next year's World Cup 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 smidgin 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 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 aside from a speculative Oscar effort over the top.
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 a 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.