Elche took the lead on the stroke of half-time through Fidel Chaves, who intercepted a poor pass from Pedri before racing into the box and striking home.
Xavi Hernandez brought on Torres at half-time and the move paid dividends. The Spain forward netted an equaliser on the hour mark, poking in from inside the six-yard box.
The next 20 minutes were frantic, with both teams creating scoring opportunities only to be denied by goalkeepers Marc Andre ter Stegen and Edgar Badia.
Barca were awarded a penalty on 84 minutes following a handball by Antonio Barragan. Referee Mario Melero Lopez consulted with the VAR before pointing to the spot and Depay made no mistake as he rifled the penalty into the roof of the net.
Elche replacement Javier Pastore received a straight card for dissent following the awarding of the penalty.
"Memphis can be an important player," Xavi said in a post-match news conference. "The penalty is unstoppable. It's a positive. He trains really well. He's the team's top scorer. He's really professional. We're managing his minutes because he's just back from an injury."
The VAR was put to work twice more after that, as Elche were controversially denied two penalties following handball appeals against Barca players.
"Handballs inside the box can always be discussed," Ter Stegen told reporters.
"Players can't take their arms off their bodies inside the area. I think the referee made the right decisions."
Having fallen as low as ninth back in November, when former coach Ronald Koeman was fired, Xavi Hernandez's revitalised Barca have climbed into LaLiga's top three with 48 points, leapfrogging Betis in third place.
"I was angry at half time because we didn't deserved to be behind after what we had created," Xavi added.
"[Elche goalkeeper] Edgar was brilliant. I was annoyed, angry. But I was hopeful that if we attacked better, we would win. That's what I told the players. I made a positional change [Ferran on] and it worked well for us."
Information from Reuters contributed to this report.