Brazil denied the United States a shock victory by coming back from two goals down to win the Confederations Cup.
A Clint Dempsey flick and a Landon Donovan strike on the counter put the US into a surprise 2-0 half-time lead.
Luis Fabiano pulled one back for Brazil before Kaka was denied an equaliser when his header was wrongly judged not to have crossed the line.
Luis Fabiano's headed second levelled matters before, five minutes from time, Lucio nodded in a corner to win it.
After upsetting the odds so spectacularly with their 2-0 semi-final victory over Spain, the US almost tore up the script again, against opponents who had beaten them 3-0 in the group stage of the competition.
Predictably, favourites Brazil had the lion's share of possession, but the incisive football was played by the American underdogs throughout the first half.
.
USA coach Bob Bradley:
"I'm extremely proud of my players, but it still feels pretty lousy to let this one get away.
"I hope though that people around the world see we have good team and great players and it is a big step forward."
Brazil coach Dunga:
"Even after we went 2-0 down the team was still sure of itself. We told them at half-time to play down the wings, keep patient.
"We did that, we have been together for 29 days and we were determined to win it.
"It is very difficult to overcome a 2-0 deficit, it is not easy, but if you have committed players who never give up then you have a chance and we came back in the second half. We showed a high level of professionalism."
USA: Howard, Spector, DeMerit, Onyewu, Bocanegra, Dempsey, Clark (Casey 88), Feilhaber (Bornstein 75), Donovan, Davies, Altidore (Kljestan 75).
Subs Not Used: Guzan, Califf, Wynne, Pearce, Beasley, Adu, Torres, Bradley, Robles.
Booked: Bocanegra.
Goals: Dempsey 10, Donovan 27.
Brazil: Julio Cesar, Maicon, Lucio, Luisao, Andre Santos (Dani Alves 66), Ramires (Elano 67), Felipe Melo, Silva, Kaka, Luis Fabiano, Robinho.
Subs Not Used: Victor, Juan, Kleber, Miranda, Josue, Julio Baptista, Kleberson, Alexandre Pato, Nilmar, Gomes.
Booked: Felipe Melo, Andre Santos, Lucio.
Goals: Luis Fabiano 46, 74, Lucio 84.
Att: 62,000
Ref: Martin Hansson (Sweden).
www.bbc.co.uk