Brazil went behind for the first time in eight games on Wednesday but responded with a controversial equaliser before netting a dramatic winner deep into stoppage time for a 2-1 victory over Colombia in the Copa America.
Brazil had won their previous nine games coming into the match in Rio de Janeiro, all bar one of them without conceding a goal, but they went behind in the 10th minute thanks to a wonder strike from Luis Diaz.
Juan Cuadrado swung in a cross from the right and Porto midfielder Diaz leapt acrobatically to volley an overhead kick past a helpless Weverton.
Brazil were forced to chase the game and they had most of the ball and almost all the chances, though Colombia did an excellent job of closing them down in the final third.
The hosts eventually got an equaliser with 12 minutes remaining, though it came in controversial circumstances.
With Brazil on the attack the ball hit referee Nestor Pitana and as Colombia's players paused expecting him to order a drop ball the Argentine, who refereed the 2018 World Cup final, allowed play to continue.
Brazil took full advantage as Roberto Firmino headed home a cross from the left, with goalkeeper David Ospina letting the ball squirm through his hands on the night he tied Carlos Valderrama as Colombia’s most capped male player with 111 appearances.
The Colombian players were incensed but the goal was allowed to stand, even after a cheque by the Video Assistant Referee.
Colombian coach Reinaldo Rueda refused to be drawn on the decision other than to say, “I think the situation with the referee distracted our players.”
There was worse to come for the visitors.
Their protests after the equaliser led to 10 minutes of stoppage time being added, and in the 100th minute of the match Casemiro headed home from a corner to give Brazil the win.
Captain Casemiro said Brazil fully deserved the three points.
"Brazil deserve congratulations for their mental strength, for being well on top, and getting our reward in the end because we had the coolness to keep plugging away in search of a goal," he added. "That’s the mentality you have to have.
"They came forward once, scored a goal, sat back and it turned into a game of attack against defence."
Brazil had already qualified for the quarter-finals and with four points from four games Colombia join them. Ecuador, Peru and Venezuela are vying for the last two spots from the group.
In Sunday's final group games, Ecuador face Brazil while Peru play Venezuela.