(CNN) -- Spain's Carlos Sainz closed in on the 2010 Dakar title when he claimed victory in the 12th stage on Thursday ahead of Qatari driver Nasser Al-Attiyah.

The former world rally champion now has a five minute 20 second overall advantage on Volkswagen teammate Al-Attiyah following the tough 796km run, of which 476km was a timed special, between San Juan and San Rafael.

Al-Attiyah finished 52 seconds behind Sainz but has little scope to make up the time on his teammate with the race set to reach its climax in Buenos Aires on Saturday

American Mark Miller came in third, and remains third overall, after finishing four minutes 22sec behind Sainz on the stage and is now 28min 12sec behind overall.

Elsewhere, Frenchman Stephane Peterhansel, in a BMW, is fourth, ahead of American Robby Gordon in a Hummer.

Al-Attiyah felt the longest stage of the race, had been particularly challenging for him and prevented him from further closing the gap on Sainz.

"Sometimes the car was on four wheels, sometimes on three, sometimes even two," he told reporters after the race.

"In some places the track was steeper than I have ever seen, almost vertical. I didn't lose much time, so it's been a good day."

Aprilia's Chilean rider Francisco Lopez won the motorcycling stage ahead of France's David Fretigne on a Yamaha.