Argentina captain Messi was seen telling teammates to leave the Maracana pitch as kick-off was delayed by 30 minutes due to crowd violence.
Supporters of the two fierce South American rivals began fighting during the national anthems and police intervened with batons.
Argentine players rushed over to the scene and goalkeeper Emi Martinez tried to defend his compatriots by disarming a police officer.
When the world champions re-emerged from the tunnel, Real Madrid forward Rodrygo reportedly shouted 'you cowards' at his opponents.
Eight-time Ballon d'Or winner Messi rushed over to the 22-year-old and grabbed him by the back of the neck.
READ MORE ON MESSI
Emi Martinez jumps to rescue fans from police as violent scenes mar Brazil vs Argentina
Inter Miami insist Messi vs Ronaldo showdown in friendly match has not been confirmed
According to TyC Sports, Messi said: "We are the world champions, why are we cowards? Look at your mouth."
Argentina would have the last laugh as Nicolas Otamendi's second-half header sealed a 1-0 victory.
Speaking afterwards, Messi said: "It was bad because we saw how they were beating people.
"The police, as it already happened in the Libertadores final, were once again repressing the people with night sticks, there were players who had families over there."
Most read in Football
Inter Miami insist Messi vs Ronaldo showdown in friendly match has not been confirmed
Liverpool man Harvey Elliott 'booed' at England U21 game despite delightful two goals
Villa man Mings allays retirement fears with rehab video after cryptic Instagram post
Ronaldo's brutal response to ex-starlet who said he could've been as good as him and Messi
The 36-year-old added: "We went to the locker room because it was the best way to calm everything down, it could have ended in tragedy.
"You think about the families, the people who are there, who don't know what's going on and we were more concerned about that than playing a match that, at that point, was of secondary importance."
Emiliano Martinez defends fans from police as violent clashes mar Brazil vs Argentina leading to Lionel Messi action