The world number one was pushed by Kyrgios on Rod Laver Arena before completing a 6-3 3-6 7-6 (8-6) 7-6 (7-4) victory after three hours, 38 minutes in the fourth round.
The Spaniard remains on track to match Roger Federer's men's record of 20 grand slam titles after reaching a 41st major quarter-final and 12th in Melbourne, where Dominic Thiem awaits.
Nadal would land the first blow of a high-quality start in the fourth game.
Highlighted by a ripping forehand passing winner, Nadal broke for 3-1 in an error-riddled game by Kyrgios, including two poor drop shots.
The first set belonged to Nadal in slightly windy conditions, the single break and 14 winners helping him take it in 36 minutes.
Nadal was booed as he made Kyrgios wait to start the second set before the latter saved three break points in the opening game.
The importance of that hold was amplified when Kyrgios, pumping up the crowd after setting up break point, produced a forehand winner down the line to take a 3-1 lead.
Facing some pressure at 30-30 serving for the set, the 24-year-old delivered two huge aces to level the match.
No early blow was forthcoming in the third set, a brave drop shot from Kyrgios seeing him save a break point in the eighth game.
A tense tie-break followed, Kyrgios and Nadal trading double faults from 5-5 before a forehand error from the Australian – who also broke a racquet – gave his opponent the set.
Coming off his epic five-setter against Karen Khachanov, Kyrgios looked beaten when he was broken to love following a double fault in the third game of the fourth set.
To his credit, Kyrgios hung in there, breaking back when Nadal was serving for the match in the 10th game, much to the appreciation of the Rod Laver crowd.
Kyrgios dug himself out of a 15-40 hole in the following game as another tie-break followed, a terrible drop shot handing Nadal a 5-3 lead he would not relinquish before the pair shared a respectful handshake at the net amid what has been a frosty relationship.
Rafael Nadal  bt Nick Kyrgios  6-3 3-6 7-6 (8-6) 7-6 (7-4)
Nadal – 64/27
Kyrgios – 50/43
Nadal – 12/4
Kyrgios – 25/5
BREAK POINTS WON
Nadal – 2/9
Kyrgios – 2/3
FIRST SERVE PERCENTAGE
Nadal – 65
Kyrgios – 75
PERCENTAGE OF POINTS WON ON FIRST/SECOND SERVE
Nadal – 85/64
Kyrgios – 73/37
Nadal – 147
Kyrgios – 124