- Frenkie de Jong (87')
De Jong popped up in the 87th minute to sweep home from close range and hand Xavi Hernandez's side all three points in a match that saw Barca struggle throughout.
Barcelona, who have already been eliminated from this season's Champions League and Copa del Rey, climbed to fifth in the standings with 35 points from 21 matches. They trail leaders Real Madrid by 15 points, with a game in hand, and are only a point adrift of fourth-placed Atletico Madrid.
"The victory was really important because of our situation in the league and the difficult season that we are going through, but we still have a lot of things to work on and improve," De Jong told reporters.
It was a lacklustre and flat game at Mendizorrotza Stadium, with players complaining about the frozen pitch.
Barca tried to shake things up after the break with the introduction of 20-year-old midfielder Nico, while Gerard Pique's close-range shot was blocked thanks to a brilliant left-footed save from Fernando Pacheco.
It was De Jong's last-gasp effort that finally swung the game Barcelona's way.
Alaves remained in 19th place with 17 points from 22 games, three points adrift of the safety zone.