Edmund earned his 6-3, 2-6, 6-3 win over the 10th-seed and former world No.1 Djokovic in an hour and 29 minutes, reports Efe.
A clear favourite to claim his 11th title at Roland Garros, Nadal will now face Diego Schwartzman of Argentina in the last 16. The 12-time grand slam champion has struggled this year after saying he returned to action too quickly following a lingering right elbow injury.
However, second seed Caroline Wozniacki and third-seeded home hope Garbine Muguruza both fell to shock defeats.
"I just felt good today, felt I was hitting the ball well", Edmund said. "That's where I draw my strength", Djokovic said.Serving to stay in the opening set, Djokovic played a terrible game and, with three set points, Edmund took the first when a driving return caught the line.
"I just knew that if I put myself in the match hopefully in the closing stages I would give myself a chance".
In his best display since reaching the Australian Open semi-finals in January, Edmund weathered a mid-match resurgence from the Serb to come through 6-3 2-6 6-3 and move to within touching distance of the world's top 20.
In the first set, he was caught napping by the Brit as he raced to the lead, but we saw more of the glimpses of the Djokovic of old, as he handed back an equally emphatic lesson, levelling the match with a double-break cushion.
Men (second round): Kyle Edmund bt Novak Djokovic 6-3 2-6 6-3; Dusan Lajovic bt Richard Gasquet 7-6 (1), 7-6 (1); Juan Martin Del Potro bt Damir Dzumhur 6-3, 6-3; Milos Raonic bt Grigor Dimitrov 7-5, 3-6, 6-3. The 12-time Grand Slam champion has an uninspiring 6-6 win-loss record in the ongoing season.
World number one Rafael Nadal has said he is confident of Novak Djokovic halting his inconsistent run and making a step-by-step progress towards returning to peak form in the coming days.
"Well, you know, look, there are obvious things that are not working well for me". Luck was on his side a little bit.
The win is likely to take Edmund inside the world's top 20 for the first time next week, and he added: "After the Australian Open it was a goal of mine to get inside the top 20, there's no reason why I couldn't".
Meanwhile in the women's section, Garbine Muguruza defeated Donna Vekic, ranked 50th in the world, 2-6, 6-4, 6-1 in the second round.
Halep beat Kristyna Pliskova 6-1, 6-4 to stay on track for a third straight title in Madrid.
'Definitely Kyle is playing the best tennis of his life'.
The Serb's disappointing year continued as he slumped to a 3-6, 6-2, 3-6 defeat.