Madrid grabbed all three points away in their opening game despite falling behind to a first-half strike by Largie Ramazani.
Lucas Vazquez equalised just after the hour mark in the second half to restore parity for Carlo Ancelotti's side.
The winner arrived with 15 minutes remaining at Almeria's Power Horse Stadium, as Alaba strode onto the pitch and curled a free-kick in off the upright after Luka Modric had been fouled just outside the box.
Real were made to work hard for the points against an Almeria side who won last season's second-tier title to return to LaLiga after a seven-year absence.
"We had lots of shots on goal but once we got the first goal it made things much easier for us," said Ancelotti.
"I am happy with the way the game went. We were not spectacular but there were lots of things to take into account, like the game on Wednesday and the heat."
At one point it looked like Madrid might suffer a defeat in their opening league game of the season for the first time since 2008, with Ancelotti's decision to rotate his squad not initially paying off.
The Italian had made five changes to the line-up that started in Wednesday's 2-0 win over Eintracht Frankfurt in the Uefa Super Cup in Helsinki, when goals by Alaba and Karim Benzema gave the defending European champions the first silverware of the campaign.
Alaba and Modric were among the players dropped to the bench, while close-season signings Antonio Rudiger and Aurelien Tchouameni were handed first competitive starts for their new club.