Nine-times world champion Sebastien Loeb ended the 2012 season with a ninth victory when he won the Rally of Spain for the eighth time in his career on Sunday in his final outing as a full-time driver.
The French Citroen driver, who will not race all of next season's rallies and will take part in the World Touring Car Championship from 2014, finished seven seconds ahead of Ford driver Jari-Matti Latvala.
Loeb's team mate Mikko Hirvonen was one minute 39.8 seconds further back in third.
"On the tarmac I was able to take the lead but today was not easy because we had some strange tyre choice and Jari-Matti was pushing very hard and getting closer" - Sebastien Loeb
Loeb had already clinched a ninth straight title at the Rally of France in October.
"For sure I really wanted to win this rally," Loeb said on wrc.com after three days of rain-affected action.
"We were really struggling in the start because it was really tricky on the first day," he added in reference to the mainly gravel early sections of the race in the Tarragona region of eastern Spain.
"On the tarmac I was able to take the lead but today was not easy because we had some strange tyre choice and Jari-Matti was pushing very hard and getting closer."
Loeb, 38, always said he wanted to quit rallying at his peak and Finn Hirvonen will become Citroen's main driver next term when the season starts in Monte Carlo on 15 January.
Loeb's victory in Spain was the 76th of his career.