Carlo Ancelotti's side trailed to an early goal by Largie Ramazani away against their promoted opponents, but Lucas Vazquez equalised just after the hour mark.
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.
Alaba free-kick gives Real Madrid win to start title defence (source: youtube) |
Real were made to work hard for the points against an Almeria side who won last season's second-tier title to return to La Liga 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.
- Rudiger caught out -
Yet the game was just six minutes old when former Chelsea defender Rudiger was caught out by a ball over the top and Ramazani ran through to beat Thibaut Courtois.
Ramazani, the 21-year-old Belgian winger who used to be on the books at Manchester United, ran off to celebrate in acrobatic fashion as Saudi-owned Almeria enjoyed a dream start to their top-flight comeback.
Yet the hosts needed some inspired goalkeeping from Fernando Martinez to keep them ahead into half-time, with the standout save coming low to his left to deny Rudiger five minutes before the break.
Vazquez then had the ball in the net in the 43rd minute only to be denied by a very tight offside call, but the full-back was the man who dragged the away side back level in the 61st minute as he pounced on a loose ball in the area to score.
Almeria, who had already seen a hanging Vinicius cross strike the frame of their goal on its way behind before that, soon conceded again.
When Modric was fouled just outside the box by Rodrigo Ely, Austrian defender Alaba was waiting on the sideline for the chance to come on.
The break in play allowed him to replace Ferland Mendy, and he came straight on to take the free-kick and score in stunning fashion to complete the latest comeback from Ancelotti's team.
Earlier, Japan star Takefusa Kubo marked his Real Sociedad debut by scoring the only goal in a 1-0 win at Cadiz.
Kubo, 21, moved to San Sebastian last month on a five-year deal from Real Madrid, after never managing to break into the first team at the Santiago Bernabeu.
Signed by Madrid from FC Tokyo as an 18-year-old in 2019, he was farmed out on loan to Mallorca, Villarreal and then Getafe, before returning to Mallorca last season.
Carlos Soler's penalty gave Valencia a 1-0 win over promoted Girona in their first La Liga outing under new coach Gennaro Gattuso.
Valencia held on after having Swiss defender Eray Comert send off early in the second half.
Barcelona were held to a 0-0 draw by Rayo Vallecano in their opening game at the Camp Nou on Saturday.
Atletico Madrid begin their campaign away at Getafe in one of three matches to be played on Monday.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional