The U.S., who shocked Spain in the semis, looked set to complete an even greater upset when goals by Clint Dempsey and skipper Landon Donovan put them 2-0 ahead at halftime.
U.S. goalkeeper Tim Howard produced several good saves before striker Luis Fabiano took his tournament tally to five when he scored immediately after the restart and headed the equaliser in the 74th minute.
Brazil captain Lucio completed his side’s stunning recovery when he rose superbly to power home an Elano corner six minutes from time.
The match was a fitting climax to an outstanding tournament which provided shocks, excellent football and passionate crowds, auguring well for next year’s World Cup finals in South Africa.
Brazil coach Dunga told a news conference he was delighted by his team’s performance.
“Even after we went 2-0 down the team was still sure of itself. We told them at halftime 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.”
Brazil had beaten the U.S. 3-0 in the group stage but faced a far tougher challenge in the final.
“The feeling is a mix of great disappointment but also great pride,” U.S. coach Bob Bradley said.
“There is no getting around it is a difficult loss having had a two-goal lead. The moment that really hurt was conceding the goal so early in the second half — that brought them right back into the game. “