Two goals in the final 13 minutes saw Deportivo la Coruña come from behind to stun La Liga leader Barcelona in a 2-2 draw at Camp Nou.

Deportivo kept the home side frustrated early on before Lionel Messi's brilliant free kick broke the deadlock. Jonathan Rodriguez spurned a couple of half-chances on the break, but Barca's second goal looked inevitable, even after Luis Suarez's second-half finish was ruled out for a marginal offside.

Ivan Rakitic duly doubled the lead with a ferocious strike just past the hour mark as Barca began to cruise to what seemed an ultimately straightforward victory.

More from FoxSports

But Deportivo, which has lost just once away from home so far this season, grabbed a lifeline through top scorer Lucas Perez in the 77th minute, and he set up Alex Bergantinos to rifle in an equalizer with just four minutes to play.

''We had everything under control until the 30-minute mark of the second half,'' Barcelona coach Luis Enrique said. ''Deportivo had a brave strategy, and it worked out for them. It isn't the result that we deserved but it shows that we have to be plugged in for all 90 minutes.''

Atletico Madrid and Real will now hope to capitalize on Barca's slip-up when they take on Athletic Bilbao and Villarreal respectively on Sunday.

Suarez volleyed wide and Messi saw a free kick saved as Barca controlled the opening quarter, but Claudio Bravo was called upon to make a smart stop at his near post after Jonathan raced through on the break for Deportivo.

Messi drew another good stop from German Lux with a curling effort before Suarez headed a Dani Alves cross over as Barca kept the visitors pinned in their own half.

But Lux could do nothing to prevent Messi giving the home side the lead six minutes before the break, as the Argentina captain curled a stunning free kick into the top corner from an almost identical position to his earlier saved effort.

Deportivo began the second half much more brightly, with Jonathan missing two presentable openings, but the away side had another let-off as Andres Iniesta's clipped cross came back off the crossbar.

Suarez's tap-in was ruled out for offside, but Rakitic gave Barca the cushion it wanted after 62 minutes, blasting the ball into the bottom-right corner having been given time and space from 20 yards out.

Messi released Suarez for a third, but the Uruguay striker's poked effort was saved comfortably by Lux, before substitute Cardoso fired wide following another break.

Deportivo had a goal ruled out after Lucas Perez headed in a rebound only to see the offside flag raised, but hopes of a comeback were kindled in the closing stages as the 27-year-old placed a shot past Bravo following Cardoso's through ball into the box.

Faycal Fajr curled wide from distance, but Bergantinos swept a superb shot from the right of the area beyond Bravo's despairing dive following another fast break led by Perez, with Barca held to just a second league draw of the season in dramatic fashion.

"The end is unexplainable, we lost control when we needed it and facilitated the opposition," Iniests told Canal Plus. "These things happen, we analyze it so that it doesn't happen again. The last two weeks we've lost four points, which makes things tighter.

"Now we change mindset because we are playing for a title and have to think of what's next. We had a 2-0 lead, the match was good. We lost the control we had throughout the match and two points escaped us."

Information from The Associated Press was used in this report.