The Argentina international agreed fresh terms at Camp Nou in June before heading to the World Cup in Brazil, where he helped his country reach the final.
However, the versatile 30-year-old continued to be linked with a move away from the Catalan club, with Serie A outfit Napoli and former club Liverpool touted as possible destinations.
Barca quickly dismissed speculation of a possible exit and revealed earlier this month that Mascherano would sign his new contract imminently.
And the club announced on Tuesday that Mascherano will be staying until at least 2018, with the option of a further 12-month extension also included in the agreement.
"I am very happy to continue at this great club and share a dressing room with great players," Mascherano told Barca's official website.
"The hope for this season is that things go very well. We have renewed hopes after having lived through a season with difficult moments.
"The idea is to have commitment to this club until the last day of my contract."
Mascherano - whose buyout clause is €100 million - moved to Barca from Liverpool in August 2010.
During his time in Spain, he has won two Liga titles, as well as the UEFA Champions League and Copa del Rey.
Mascherano was sent off as Barca started their new league campaign with a 3-0 victory over Elche on Sunday.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.