Korda - ranked world number 40 - served for the match in the final set to earn a famous victory only for the Spaniard to break and secure a tie-break win.
Nadal - who won a record-breaking 21st Grand Slam at the Australian Open - continued his remarkable start to the season but did not have it all his own way.
After taking the first set 6-2, Nadal, 35, was immediately broken in the second set and won 6-1.
And Korda looked set to hand the Spaniard a first loss of the season at 5-4 in the final set.
However, a stubborn Nadal rallied to level at 5-5, saved a break point in his next service game, and forced a final set tie-break, in which he fell 3-2 behind before rallying for another impressive win.
Next up for Nadal is Britain's Dan Evans, who swept past Federico Coria 6-2 6-0.
Cameron Norrie began his defence of the title he won in the desert last year with a straight-sets victory over Spaniard Pedro Martinez.
The world number 12 told Amazon Prime after the match: "Not an easy second-round match, he (Martinez) came out with nothing to lose and was very aggressive, but I was very happy with my level towards the end there."
The 6-3 6-3 result sees Norrie through to the third round, which will be a repeat of the 2021 Indian Wells final as the British number one takes on Nikoloz Basilashvili of Georgia.
Daniil Medvedev won his first match as world number one as he beat Tomas Machac of the Czech Republic to advance to the third round.
Medvedev, who is playing under a neutral flag as part of sporting sanctions following Russia's invasion of Ukraine, must reach at least the quarter-finals to keep his place at the top of the rankings.
He was forced to save a break point in the first game of the match but subsequently only dropped eight further points on his serve as he eased to a 6-3 6-2 win in one hour and 11 minutes.