Ding is ranked No. 1 in the world and Li second in those rankings, but Li put together a 4-1 victory in the best-of-seven games championship match.
The contest lasted 51 minutes with Li prevailing 11-8, 14-12, 8-11, 11-6, 11-4.
This was the first table tennis final at the London Games and the result was predictable. It was the 25th table tennis gold medal awarded since the sport became a part of the Olympic program in Seoul 24 years ago and China has won all but four of them.
The bronze medal went to Tianwei Feng of Singapore, who defeated Japan's Kasumi Ishikawa in four games.
China also put two competitors into the men's semifinals -- No. 1 seed Zhang Jike and second-seeded Wang Hao.