In his search for an unprecedented 10th title at Roland Garros, the fourth-seeded Nadal began with a 6-1, 6-4, 6-1 victory over France's Benoit Paire.
Djokovic and Nadal could meet in the semifinals.
Djokovic completed a career Grand Slam in Paris last year but has been struggling since. He can become the first man in the Open era -- and only the third in history -- to win each of the Grand Slams twice. The 30-year-old Serbian is now 56-11 at the clay-court major.
Granollers, who is ranked 33rd in the world, had three break points when Djokovic was serving for the match before the world No. 2 recovered for the victory.
"Two and a half hours for three sets is quite long, credit to Marcel," Djokovic said afterward. "He disrupts your rhythm.
"We played some very, very long games and he came up with some big serves when he needed to. I'm still looking to play 100 percent, but I'm happy with straight sets."
Djokovic next will next face Portugal's Joao Sousa, who beat Serbian Janko Tipsarevic 4-6, 7-6 (3), 6-2, 6-2.
The fourth-seeded Nadal played had to survive a minor scare in the second set against Paire, who is ranked 45th. Paire twice broke Nadal and led 3-1 before the 30-year-old Spaniard broke back and went on to take the set.
American Jack Sock, the No. 14 seed, recorded his worst result ever at the clay-court Grand Slam, losing 7-5, 7-5, 6-3 in the first round to Jiri Vesely of the Czech Republic. Sock hit 39 unforced errors and dropped serve six times.
In other men's first-round results, fifth-seeded Milos Raonic of Canada swept past Steve Darcis of Belgium 6-3, 6-4, 6-2 in 92 minutes. No. 10 seed David Goffin of Belgium beat French qualifier Paul Henri-Mathieu 6-2, 6-2, 6-2.
American Steve Johnson, seeded No. 25, held off Yuichi Sugita of Japan 6-3, 6-3, 6-7 (4), 6-7 (3), 6-3 to finish their match that was suspended overnight because of darkness.