Contador, who won the three-week race for the first time in 2008, is only the second rider after France's Bernard Hinault to have won the three grand tours - the Tour de France, Giro d'Italia and Vuelta a Espana - at least twice.
"Alberto Contador already is one of the greatest cyclists of all time. Congratulations for the extraordinary victory," Rajoy said in a Twitter message on Sunday.
The 32-year-old Tinkoff-Saxo team leader survived a dislocated shoulder, untimely crashes and a daring late challenge from young home hope Fabio Aru (Astana) to finish with a comfortable winning margin.
The win was his seventh in a Grand Tour, two coming in the Tour de France, two in the Giro and three in his home tour in Spain.
It takes him up to fourth place in the list of the all-time grand tour winners behind Belgium's Eddy Merckx (11), France's Bernard Hinault (10) and France's Jacques Anquetil (8), and puts him level with fellow Spaniard Miguel Indurain and Italy's Fausto Coppi.
Contador, who lost his 2010 Tour and 2011 Giro titles after a positive dope test, will now try to become the first rider since the late Marco Pantani in 1998 to win the Giro and Tour de France in the same year.
The Tinkoff-Saxo leader will start his preparation for the Tour with a training/recovery camp before riding the Route de Sud.