The Estonian, who won all six stages on Saturday's second leg, then spun and lost two minutes in the late drama.
Finland's Teemu Suninen finished second for M-Sport Ford, 13.7 seconds behind, with Norwegian Andreas Mikkelsen third for Hyundai and claiming five bonus points from the power stage.
The win was Sordo's first since 2013 and second of his career.
Six-times world champion Ogier hit a rock and retired on Friday but returned to limit the damage by taking four bonus points in the power stage.
Tanak is now four points clear of Ogier in the championship.
(Reporting by Alan Baldwin, editing by Pritha Sarkar)
Share
