The visitors pulled off an incredible late escape after picking up a point at Camp Nou, while Xavi bid farewell in his final game for Luis Enrique's side
In what was Xavi's final outing as a Barca player, Lionel Messi stole the show for the opening hour and gave the home side the lead after just five minutes.
The Argentina ace doubled his tally for the day with his 56th goal of the season across all competitions - a tap-in just shy of the hour mark putting the visitors on course for relegation.
However, Lucas Perez's 67th-minute strike gave Deportivo hope and they continued to battle away in the hope of pulling off a great escape.
Diogo Salomao then lashed home an equaliser with 14 minutes to go, sparking scenes of jubilation on the bench as Victor Sanchez's men secured their top-flight status at the expense of Eibar and Almeria - who also finished on 35 points.
Xavi was unsurprisingly the centre of attention before kick-off, as the Barca fans held aloft a huge banner in tribute to the legendary midfielder.
And Barca appeared to be spurred on by the atmosphere created by their supporters, as they opened the scoring early on.
Rafinha pounced on a half-hearted punch by Fabricio and chipped an inviting delivery to the back post, with Messi arriving late to nod past the helpless goalkeeper.
Things should have got worse for Deportivo 13 minutes later, but on this occasion Fabricio proved a vital last line of defence, tipping away Messi's 25-yard effort before thwarting Pedro from the rebound.
Barca continued to dominate proceedings, though clear-cut chances were few and far between.
Xavi look destined to mark his Camp Nou farewell with a goal in the 42nd minute, only to see his 20-yard effort deflect wide after the goal had seemingly opened up for him.
The second half began with Barca looking to increase their urgency and they were rewarded for their improvement with 59 minutes on the clock.
Neymar raced through on goal and unselfishly prodded a pass to his right for Messi, who was left with the simplest of finishes.
But Deportivo gained a lifeline eight minutes later, Lucas finding the top-left corner in emphatic fashion from the edge of the area.
And shortly after, the visitors completed what had seemed an impossible turnaround as Salomao smashed a half-volley into the bottom-right corner after Barca failed to clear a free-kick.
Barca pushed for a late winner, but the only incident to bring the home fans to their feet was the departure of Xavi.
The Qatar-bound midfielder was substituted four minutes from time to rapturous applause, bringing his time at the club to an emotional close, while Deportivo celebrated an incredible relegation survival story.