Nadal, aiming for a men's record 21st Grand Slam singles title, was facing his first seeded opponent and dropped his first set of the tournament.
The sixth-seeded Nadal struggled in the third set Friday when the 6-foot-6 Russian broke to go up 3-1 before taking the set in 57 minutes at Rod Laver Arena in Melbourne.
But the 35-year-old Nadal quickly regained control in a dominant fourth set, twice breaking the Olympic silver medalist.
Djokovic, a nine-time champion at Melbourne Park, couldn't play after having his visa canceled for failing to meet Australia's strict COVID-19 vaccination regulations. Federer is skipping the Australian Open while he continues his recovery from injury.
The seventh-seeded Berrettini wasted a match point when Alcaraz was serving to force a fifth-set tiebreaker, netting a return to a second serve.
But the 25-year-old Italian player dominated the match's super tiebreaker, taking a 9-5 lead to get four more match points before the No. 31-ranked Alcaraz finished with a double fault.
"He's unbelievable. At his age, I didn't even have an ATP point,'' Berrettini said. "He's impressive. He'll only improve, playing matches like this. He's showed everyone his potential."
Berrettini advanced to the fourth round at Melbourne Park for the second straight year and for the eighth time at a Grand Slam event, equaling Fabio Fognini and Adriano Panatta's Open-era record for the most by an Italian man.
The third-seeded Zverev finished it off with his third match point in just under two hours. He converted three of his six break-point chances and fended off all five on his own serve.
Zverev hit 44 winners and 16 aces to prepare for his next match against No. 14-ranked Denis Shapovalov of Canada, who beat No. 23 Reilly Opelka 7-6 (4), 4-6, 6-3, 6-4 in another men's third-round match.
Miomir Kecmanovic is making the most of the absence of his fellow Serbian Djokovic, reaching the fourth round at a major for the first time with a 6-4, 6-7 (8), 6-2, 7-5 win over No. 25-seeded Lorenzo Sonego.
He had been drawn to play the top-ranked Djokovic in the first round. Kecmanovic instead faced Salvatore Caruso -- a so-called lucky loser from qualifying -- in the first round and Tommy Paul in the second.
The Associated Press contributed to this report.