The Catalans 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 10 minutes from Ivan Rakitic and Coke levelled proceedings to silence the home fans, before Alexis Sanchez snatched a winner deep into injury time to secure a 3-2 win.
Mascherano, speaking to the club's official website, stressed that his side need to prevent complacency in the future, or face being punished for their mistakes.
"We have to improve a lot," the 29-year-old stated.
"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."
The win allowed Barcelona to maintain their 100% league record and, with the Blaugrana preparing to face Ajax at Camp Nou on Wednesday, Mascherano was keen to stress that he was not trying to be overly critical.
"This doesn't mean that we played poorly," he added.
"They are just our errors and we have to minimise them."