His brother Marcos was fourth on the 29km special on the final stage between Pisco and Lima in Peru and finishes second overall, with stage winner Tomas Maffei, also of Argentina, third.
Uruguayan Sergio La Fuente was second on the final special, 49 seconds off the pace.
"I don't know how often such things can happen, so I have to enjoy every minute," said Alejandro Patronelli. "There is a team behind us that has allowed us to achieve this dream.
"I can't believe the Dakar is over. It was difficult at times but everything turned out okay. It's my second victory. It's very hard to win twice in a row.
"Last year I suffered a lot with my hand pain, but this year everything was perfect from the beginning to the end. No problems at all. Thank God. I'd like to thank everyone who cheered me on."
The top six overall were all riding Yamahas in this year's race.
Marcos Patronelli said: "It is amazing... a great triumph. A 1-2 has been repeated with Alejandro that is historic."