A brace from Sergi Roberto was enough to secure Barcelona their first win in four games against a spirited Almeria side.
Almeria came from behind on two occasions to draw level with Barca, however a late goal from captain Roberto ensured of all three points for the home side.
The result moves Xavi Hernandez's side up to third in the La Liga table, six points adrift of table-toppers Girona.
How the game unfolded
Barcelona started the game well, and really should've taken the lead in the seventh minute when Sergi Roberto was found completely unmarked in the heart of the penalty area from a set piece. The Barca captain's headed effort on goal wasn't directed quite far enough beyond the reach of Almeria's Luis Maximiano however, and the goalkeeper was able to claw the ball clear of danger.
Set pieces would prove to be Barca's best route to goal in the first half, with the second chance they created of the game being courtesy of a corner kick and, this time, resulting in the opening goal. Joao Cancelo's delivery was met by Ronald Araujo in the penalty area, and after the defender saw his header well saved by Maximiano, Raphinha was able to steal in and sweep home at the second time of asking.
It was so nearly 2-0 shortly after, with Robert Lewandowski's curling effort from just inside the penalty area being denied by the outstretched arm of Maximiano. The out-of-form Lewa perhaps should've done a bit better with his effort on goal.
Barca were made to rue that missed chance on the stroke of half-time when some sloppy defending led to Almeria drawing level.
La Blaugrana's backline fell asleep in the 42nd minute, allowing Sergio Arribas to play Leo Baptistao clean through on goal. The veteran striker made no mistake with his subsequent finish, dinking beautifully over Inaki Pena in the Barca goal.
The half-time introduction of Ferran Torres for Joao Felix (who did absolutely nothing with his 45 minutes on the field), provided Barca with some renewed vigour in the final third. On two occasions inside the first five minutes of the second half, Ferran came close to making it 2-1 - being denied twice by the in-form Maximiano in the Almeria goal.
The home side eventually got their second goal in the 59th minute of the game - once again via a corner kick. Having missed a brilliant chance from a corner earlier in the clash, Roberto made amends by rushing to the near post and flick a header across goal and into the top right corner of the net.
Despite dominating proceedings for the majority of the rest of the half, yet another mistake proved costly for Barcelona in the 70th minute. This time it'd be goalkeeper Pena who'd make the error, dropping the ball right to the feet of Edgar Gonzalez after initially gathering a cross into the penalty area - allowing the defender to tap into an empty net to make it 2-2.
12 minutes later, Barcelona retook the lead through captain Sergi Roberto. The midfielder raced into the box to latch onto a clever through ball from Lewandowski, before slipping the ball under Maximiano.
Almeria would create one last chance to escape Catalunya with a point on Wednesday evening, with Pena diving to his left to make a stunning stop to deny a Idrissu Baba in the final five minutes of the game.
Barcelona player ratings
GK: Inaki Pena - 4/10 - Made a calamitous error to gift Almeria their second goal, but made up for it with a great save late in the game.
RB: Joao Cancelo - 6/10 - Caused Almeria problems with his set piece deliveries.
CB: Ronald Araujo - 4/10 - A bit all over the place, particularly in the lead up to Almeria's first goal of the game.
CB: Andreas Christensen - 4/10 - Struggling for form at the moment, as exemplified by his half-time substitution.
LB: Alejandro Balde - 5/10 - The youngster didn't get forward as much as one would've hoped.
CM: Sergi Roberto - 8/10 - Scored a brilliant brace to win his side the game. A captain's performance.
CM: Ilkay Gundogan - 6/10 - Used the ball well, completing 90% of his passes.
CM: Fermin Lopez - 5/10 - Not at the races on Wednesday evening. He needs to do more if he's going to be the man to fill the void left by Gavi.
RW: Raphinha - 6/10 - Scored just his third goal in all competitions this season.
ST: Robert Lewandowski - 6/10 - No matter how hard he tries, Lewa can't buy a goal at the moment. He can buy an assist though at least; setting up the winner on the night.
LW: Joao Felix - 2/10 - He might as well have not been on the pitch.
Substitutes
SUB: Jules Kounde (45' for Christensen) - 6/10
SUB: Ferran Torres (45' for Felix) - 7/10 - Made a huge difference for Barca after being introduced.
SUB: Oriol Romeu (67' for Fermin) - 6/10
SUB: Lamine Yamal (76' for Raphinha) - 5/10
Manager - Xavi Hernandez - 6/10 - Without his starting midfield, Xavi's team once again struggled to control at game on their home turf. His half-time substitutions may have saved his job, with the introduction of Ferran poving to be a great decision.