Colombia was left seething when Brazil substitute Roberto Firmino's 78th-minute equaliser came after the ball deflected off referee Nestor Pitana in the build-up – the official allowing play to continue rather than call for a drop-ball, leading to lengthy protests from Colombia.
Brazil compounded Colombia's frustrations after Casemiro struck in the 10th minute of stoppage time as the Selecao extended their winning streak to 10 games.
Reinaldo Rueda's Colombia took the lead in stunning fashion, when Juan Cuadrado whipped in a cross from the right flank, finding an unmarked Diaz – who fired home a sensational bicycle volley at the back post in Rio de Janeiro.
Brazil, which went into the game having scored more goals (seven) and had more shots on target per game (eight) than any other team at this year's Copa America, struggled to create chances in the first 45 minutes.
Neymar had his first sniff on goal in the 55th minute from a direct ball he volleyed tamely on target, while he shot wide from outside the box shortly after.
In the 66th minute, half-time substitute Firmino produced a clever pass for Neymar to round goalkeeper David Ospina, only to hit the post off-balance from an angle.
Brazil found an equaliser with 12 minutes remaining, although it was controversial after the ball hit the referee in the lead-up, with play allowed to continue, rather than a drop-ball.
Tite's Selecao immediately pushed the ball wide to substitute Renan Lodi, whose cross was glanced in by Firmino, with Ospina unable to prevent it from creeping under him.
With virtually the last kick of the game, an unmarked Casemiro headed in Neymar's corner at the near post, sparking mass celebrations.