The club was in danger of a third straight league loss but recovered late.
Barcelona produced a late comeback to steal a 2-1 win from the jaws of defeat and bounce back from successive La Liga losses.
Luis Enrique's men were in danger of suffering a third successive league defeat for the first time since 2003 as Thievy Bifouma gave the host a well-earned first-half lead, but goals from Neymar and Jordi Alba in the final 17 minutes secured the spoils for Barca.
The visitor was far from its clinical best as Lionel Messi again missed a chance to equal Telmo Zarra's La Liga goals record just a few days after matching Raul's landmark tally in the UEFA Champions League victory at Ajax.
And Thievy capitalized on Barca's wastefulness in the 37th minute, producing a precise finish after charging away from the Barca defence.
The visitor appeared to be heading for another morale-sapping defeat in the league, but Neymar – introduced at the break along with Luis Suarez – bundled the Uruguayan's cross home in the 73rd minute to provide the spark for a turnaround.
Alba netted the all-important winner inside the final 10 minutes, with Suarez integral again, keeping Barcelona in the hunt at the top.
Luis Enrique surprised many by opting to leave both Suarez and Neymar on the bench in Andalucia, although Barca looked perfectly capable going forward early on despite their absence.
Messi was denied his record-matching goal in the ninth minute, though, as he was twice thwarted from close range by Ruben in the Almeria net, with the goalkeeper also palming a Munir El Haddadi effort around the post.
After that let off, the host seemed to grow into the encounter and with both Thievy and Jonathan Zongo causing problems, Barca looked particularly uneasy at the back.
Thievy tested Claudio Bravo following a clever run in the 22nd minute, but the home side should have been behind by the half-hour mark.
Ivan Rakitic saw his header kept out by Ruben and from the rebound Messi inexplicably nodded against the crossbar despite having an open goal at his mercy.
And Almeria made it pay eight minutes before the break, as former Espanyol attacker Thievy burst onto Fernando Soriano's through ball and cooly slotted past Bravo after outpacing the Barca defense.
Luis Enrique responded by introducing Neymar and Suarez at halftime, and the latter almost drew Barca level in the 61st minute.
Almeria failed to deal with a corner, and Suarez produced an acrobatic attempt at the back post, with only the crossbar keeping the host's lead in tact.
Barca eventually restored parity, though, as Neymar turned in Suarez's low cross despite the best efforts of Ximo Navarro.
And the winner arrived soon after, as Alba steered in Suarez's cross to spare Barca's blushes.