Alaves had lost to relegation-battling Espanyol in their first game back after the league's resumption but found their form at Estadio de Mendizorroza.
The deadlock was broken in the 57th minute when a well-judged ball over the top from Victor Laguardia found Lisandro Magallan in the box. His slightly heavy touch invited Borja to take matters into his own hands, which the 19-year-old did in some style.
Both sides had a man sent off in the closing stages, Joseba Zaldua and Tomas Pina both picking up their second yellow cards, before Martin Aguirregabiria placed into an empty net deep into added time following a save by Alex Remiro.
The result puts Alaves 10 points clear of the bottom three but puts a serious dent in Sociedad's hopes of keeping in touch with the top four.