The Liverpool No.9 was sent on at half-time in Rio de Janeiro with his country trailing to a stunning Luis Diaz volley.
Firmino then levelled for Tite’s team with a downward header from a left-wing cross, before Casemiro provided a winner in the 10th minute of stoppage time.
Alisson Becker and Fabinho were unused substitutes for Brazil, who have now confirmed top spot in Group B at the tournament.
They will wrap up the section when they face Ecuador on Sunday night.