Mascherano, a combative midfielder at River Plate, Corinthians, Liverpool, and Barcelona amongst other clubs, made his surprise announcement after his side Estudiantes lost 1-0 to Argentinos Juniors in a league match on Sunday.
"I lived my profession 100%, to the maximum that I possibly can, and for a while now that has been getting harder," he told reporters. "Sometimes you don't choose the end, it happens all by itself."
Lionel Messi, Mascherano's longtime teammate at Barcelona and on the Argentina team, joined others in sending farewell wishes via an Instagram post that also bid farewell to former Argentina and Real Madrid star Fernando Gago.
"And what can I say about Masche, so many years together, seeing each other every day and sharing so much....We shared very happy moments and also some tough ones on the pitch in Argentina and in Barcelona as well. We have been missing you since you left. I wish all the best to you and to your family always!"
Mascherano enjoyed his most successful spell at Barcelona, where he won 19 titles in eight years, including five La Ligas and two Champions Leagues.
He played 147 times for Argentina, appearing in four World Cup finals. He also won two gold medals with the Argentine Olympics team in 2004 and 2008.