The Catalan giants appeared to be cruising to a fourth consecutive top-flight win of the campaign thanks to strikes from Daniel Alves and Lionel Messi.
However, two goals in the last ten minutes from Ivan Rakitic and Coke levelled proceedings to leave the home fans silenced.
Despite this setback, Barcelona's blushes were spared when Alexis Sanchez snatched a winner deep into injury time.
But defender Mascherano has warned his team-mates to prevent complacency in the future, or face being punished for their mistakes.
"We have to improve a lot," he told the club's official website. "Because of our errors they tied the match.
"We were lucky to win but it won't always be this way. Everything will get more difficult in the future.
"What we can't allow is to have a two-goal lead and have what happened happen.
"This doesn't mean that we played poorly. They are just our errors and we have to minimise them."
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.