Lei was seeded only eighth in the 64-man tournament and he defeated someone in the final who was even more of an outsider than he was -- Egypt's Alaaeldin Abouelkassem.
The silver medal for Abouelkassem was the first ever won in the sport by an African nation. Egypt once placed fourth in men's team foil, but that achievement came 60 years ago.
Lei surprised second-seeded Valerio Aspromonte of Italy in the quarterfinals and then reached the gold medal match with a victory over another Italian, Andrea Baldini.
Abouelkassem stunned four-time world champion Peter Joppich of Germany in the round of 16 and then beat the current world No. 1, Italy's Andrea Cassara, in the quarterfinals.
The bronze medal went to South Korea's Byungchul Choi, who defeated Baldini to win it.
Costly malfunction causes beer flood at Boston-area brewery
Wisconsin business offering 'therapeutic cuddling' forced to close