Hosts Brazil have beaten Italy 4-2 in Confederations Cup Group A and will go through to the semi-finals as group winners.
It was a very bright start from the Brazilians and Oscar tested Gianluigi Buffon early as he followed up a superb sliding tackle from Giorgio Chiellini.
Then on 20 minutes Claudio Marchisio took advantage of some slack Brazil defending to find Mario Balotelli, but the AC Milan man shot wide.
With the first half looking like fizzling out, Dante tapped in a rebound in stoppage time to send the hosts into the break in the lead.
It was a completely different game in the second half, with Emanuele Giaccherini equalising for Italy just five minutes after the restart with a fine finish.
Four minutes later Brazil were back in front, Neymar lashing a free kick into the top corner out of reach of the sprawling Buffon.
In the 66th minute the result looked settled, this time Fred controlling superbly before thrashing past the helpless Italian goalkeeper.
After some mass confusion in the Brazil box, Chiellini took advantage to bury from close range and give Italy a fighting chance.
However, Fred pounced on a late rebound to seal the points and send Brazil through as group winners.