Also, Real Sociedad trailed twice before drawing 2-2 at Espanyol to strengthen its hold on fourth place and extend its league-best run of just one loss in its last 19 games, while Osasuna beat Valladolid 3-1.
Already facing a must-win game, Deportivo looked finished when Victor Casadesus put Mallorca ahead in the 19th minute.
But defender Silvio Azevedo sparked Deportivo to life with a superb individual effort to score in the 27th. Carlos Marchena then scrambled in Deportivo’s second goal in the 48th, and Ivan ”Riki” Sanchez nodded in a rebound to make it 3-1 in the 60th.
Mallorca forward Alejandro Alfaro cut the deficit with a goal four minutes from time, but the visitors clung to the three points.
Deportivo remained bottom of the table despite its first back-to-back wins of the season, just one point below fellow drop-zone members Mallorca and Celta Vigo. Safety is another three points away with nine games to go.
”After winning here and at Celta we have moved a little closer to staying up,” said Fernando Vazquez, Deportivo’s third coach of its strife-filled season. ”We gave it our all and were able to get the win thanks to a good second half.
”If Mallorca was nervous, imagine how we were. These psychological factors are difficult to evaluate, but it’s true that Mallorca is also in a tough situation.”
In Barcelona, Espanyol’s disciplined defense kept Sociedad in check until the final 20 minutes when the Basque side pressed for the victory but had to settle for a point.
Sociedad midfielder David Zurutuza canceled out Sergio Garcia’s ninth-minute opener by deftly volleying in a clearance by goalkeeper Kiko Casilla that fell to him outside the box in the 23rd.
Garcia floated a cross for Christian Stuani to stab home in the 39th, but Sociedad’s passing attack finally gained the initiative and paid off in the 76th when Espanyol defender Javi Garcia redirected Antoine Griezmann’s low cross into his own net.
Sociedad moved one point clear of Malaga in the race for a top-four finish and Champions League berth. Espanyol is unbeaten in eight home games under coach Javier Aguirre.
Earlier, Osasuna striker Kike Sola scored a double to help Osasuna overcome an early own goal to fight back for a win at Valladolid, breaking a three-game losing streak.
Valladolid outplayed the visitors in the first half with Osasuna goalkeeper Andres Fernandez making two key saves after his defender Ruben Gonzalez had headed a cross into his own net in the 11th.
But the second half was all Osasuna’s as Sola headed in a ball that goalkeeper Dani Hernandez had let escape his grasp in the 50th. Sola added a second header with his back to the net in the 60th, before Miguel de las Cuevas hit on the break nine minutes later.
The victory at Jose Zorilla Stadium lifted Osasuna seven points clear of relegation.