Djokovic has reached the final in four of the five past years at the Foro Italico, winning the title in 2008 and 2011.
He dropped serve to trail 2-1 in the opening set but broke back immediately and took control from there against his 32-year-old opponent.
Djokovic, a six-time Grand Slam champion, twisted his right ankle while playing for Serbia in the Davis Cup in April. He then appeared to hurt it again during a second-round loss to Grigor Dimitrov at the Madrid Open last week.
In the first round, Julien Benneteau of France eliminated 12th-seeded Nicolas Almagro 7-6 (2), 6-4; Mikhail Youzhny beat 13th-seeded Tommy Haas 6-4, 6-3 in a matchup of tour veterans; former top-10 player Fernando Verdasco of Spain defeated Horacio Zeballos of Argentina 6-3, 3-6, 6-3.
Wozniacki, seeded 10th, wasted a 5-2 lead in the third-set tiebreaker. The Dane has struggled on clay this season, losing to Yaroslava Shvedova in the first round in Madrid and to Carla Suarez Navarro in her first match in Stuttgart, Germany, last month.
Eighth-seeded Petra Kvitova overcame a second-set lapse to beat Sabine Lisicki of Germany 6-4, 0-6, 7-5 and reach the third round.
In the first round, 12th-seeded Maria Kirilenko of Russia eliminated Spanish qualifier Anabel Medina Garrigues 6-3, 6-3 and will next face 31st-ranked Varvara Lepchenko of the United States, who defeated Ukrainian qualifier Lesia Tsurenko 6-4, 6-2.