Yazdani, 21, trailed 6-0 after the first period but levelled with three seconds of the match left and eventually won on countback.
His victory gave Iran its first wrestling gold at Rio 2016, adding to three bronze medals.
Geduev, a three-time European champion, had been the favourite.
Earlier on Friday he had pulled off a stunning upset when he defeated the heavily fancied Jordan Burroughs of the United States, the Olympic champion in 2012.
Azerbaijan's Jabrayil Hasanov and Turkey's Soner Demirtas won their bronze-medal bouts, beating Uzbek Bekzod Abdurakhmonov and Kazakh Galymzhan Usserbayev respectively.
Find out how to get into wrestling with our special guide.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.
Iran's Hassan Yazdani came from six points down to beat Russian Aniuar Geduev in a dramatic men's -74kg freestyle gold medal bout.