Substitute Riqui Puig struck at the death as Barcelona left it late to secure a fifth-successive LaLiga win on the road as they were made to work hard for the points at lowly Elche.
Frenkie De Jong's 39th-minute opener was all that separated the sides as the clock ticked down towards the final minute of the 90 at the Martinez Valero Stadium before Puig headed home the Dutchman's cross to seal a 2-0 victory.
Elche kept themselves in it to the death thanks in large part to a string of fine saves by goalkeeper Edgar Badia, who denied substitute Trincao twice inside the final seven minutes.
Victory lifted the Catalan side above Sevilla into third place, three points adrift of arch-rivals Real Madrid in second, but still seven adrift of leaders Atletico Madrid ahead of their evening kick-off against Valencia.
The visitors started in determined fashion and defender Ronald Araujo headed over from Ousmane Dembele's corner before the same man fed Antoine Griezmann and saw him force a 12th-minute save from Badia.
Elche responded with Raul Guti heading Johan Mojica's delivery over from close range eight minutes later, but it was Barca who continued to press and Badia had to field Sergio Busquets' attempt from distance 11 minutes before the break.
The breakthrough finally arrived six minutes before half-time when defender Diego Gonzalez's effort to prevent Martin Braithwaite's cross reaching Griezmann only succeeded in setting up De Jong to tap home on the line.
Elche midfielder Josan called upon goalkeeper Marc-Andre Ter Stegen to make his first save of note seconds later, but Ronald Koeman's side went in at the break with the slightest of advantages.
Guti and Emiliano Rigoni both went close as Elche attempted to drag themselves back into the game immediately after the break with Ter Stegen needing to be at his best to prevent the latter from making the most of a defensive slip.
However, Badia had to keep out Dembele's 56th-minute effort and was stretched further by Pedri's deflected strike 11 minutes later with Barca looking to wrap up the points.
Trincao forced another vital stop from the keeper with seven minutes remaining and then kept out his 87th-minute header to keep the home side in the hunt, but there was nothing he could do to repel fellow substitute Puig's header at the death.
No Data Analysis info