The 19-year-old Alcaraz recovered from a bad ankle twist early in the second set to earn his first victory against the 21-time Grand Slam champion, marking what could be the beginning of a changing of the guard in Spanish tennis.
"It's obvious there is [a change in guard]," Nadal said. "He turned 19 yesterday, I'm almost 36 years old. If [the change] begins today or not, we will find out in the next months. I'm happy for him. He was better than me in several aspects of the game."
It was Nadal's first loss to a Spanish competitor in six years, since falling to Fernando Verdasco at the 2016 Australian Open. He had a 138-21 record against his countrymen entering the match against Alcaraz.
"It means a lot to me to beat Rafa, to beat the best player in the history on clay,'' Alcaraz said. "This is the result of all the hard work I've done.''
Still far from his best form after a six-week injury layoff, Nadal predicted a hard time keeping up with the energy of Alcaraz. And he was right early on, as the youngster overpowered him to easily win the first set with three breaks.
But Alcaraz lost momentum after needing medical attention for the ankle, losing 20 of the next 22 points as Nadal cruised through the second set.
The match also was interrupted in the second set after a fan became ill in the stands of the Caja Mágica center court.
Both players got off to a great start this season as they seek their fourth title of the year, which would be the most on tour.
Nadal's run was hampered by a rib stress fracture suffered in his semifinal win against Alcaraz in Indian Wells. His other win against the ninth-ranked Alcaraz came in Madrid last year, when the youngster was just starting to attract everyone's attention.
The 35-year-old Nadal saved four match points to get past David Goffin in a third-round match that lasted more than three hours on Thursday.
He said it was a positive balance for him after winning two matches following his injury layoff.
"I accept this loss naturally and with tranquility," Nadal said. "I'm know the path I have to stay on so I can arrive (in Paris) with real options in two-and-a-half weeks' time. That's what I'm working on right now.
"I have done what I could. I have had better days, worse days. But it has not been a disaster in any case. I have competed with the correct attitude. I have played two, two-and-a-half hours, nearly three, I think three matches, this is a positive outcome.''
Three-time Madrid champion Djokovic had little trouble against Hurkacz. The Serbian star took advantage of Hurkacz's slow start and took a 3-0 lead after the Polish player ceded his first service game by hitting long.
Another spate of unforced errors cost Hurkacz a second-set break when he smacked a forehand long. Djokovic's dominance never waned and he won on his fourth match point.
Djokovic beat Gael Monfils in straight sets to start his campaign at the outdoor clay tournament, and Andy Murray gave Djokovic a walkover after withdrawing because of a stomach illness before their match on Thursday.
Djokovic is trying to regain his best form after not being allowed to play in the Australian Open because he was not vaccinated.
"It's definitely a positive indication that I am on the right track in terms of getting to the desired level of tennis, being in one of the best tournaments in the world where all the best players are playing,'' Djokovic said. "It does give me confidence, and it encourages me to keep going. I have a lot of positives to take from the last couple of days.''