CAS backdated Contador's ban, and he is eligible to return to competition on Aug. 6. The ban means Contador will miss the Giro d'Italia, the Tour de France and the London Olympics, but he would be eligible to ride in the Spanish Vuelta, which begins Aug. 18.
Contador had no immediate comment and is expected to hold a news conference Tuesday. He can appeal the verdict to Switzerland's supreme court.
The ruling came just three days after U.S. federal prosecutors dropped a doping investigation involving seven-time Tour winner Lance Armstrong. The American was a teammate of Contador during the Spaniard's 2009 Tour victory. The revised list of champions shows Armstrong and Contador combined to win nine of the 11 Tours from 1999-2009.
Contador blamed steak bought from a Basque producer for his high reading of clenbuterol, which is sometimes used by farmers to fatten their livestock. To avoid a doping ban, he needed to prove how the anabolic drug entered his body and convince the panel he was not to blame.
In its ruling, CAS said the presence of clenbuterol was more likely caused by contaminated food supplement than by eating contaminated meat.
"Unlike certain other countries, notably outside Europe, Spain is not known to have a contamination problem with clenbuterol in meat," CAS said in its ruling in Lausanne, Switzerland. "Furthermore, no other cases of athletes having tested positive to clenbuterol allegedly in connection with the consumption of Spanish meat are known."
Contador is one of only five cyclists to win the three Grand Tours - the Tour, the Giro and the Vuelta. He also won the Tour de France in 2007 and 2009.
He becomes only the second Tour de France champion to be disqualified and stripped of victory for doping. The first was American Floyd Landis, who lost his 2006 title after testing positive for testosterone.
Andy Schleck of Luxembourg, who finished second at the 2010 Tour, stands to be elevated to victory.
"There is no reason to be happy now," Schleck said in a statement issued by his team, RadioShack Nissan Trek. "First of all I feel sad for Alberto. I always believed in his innocence. I battled with Contador in that race and I lost."
Contador kept racing after his positive test on a 2010 Tour rest day. He will be stripped of all results from races in which he participated since Jan. 25, 2011 - the day the Spanish federation proposed a one-year ban. That period includes his Giro d'Italia victory last season.
"This is a sad day for our sport," UCI president Pat McQuaid said. "Some may think of it as a victory, but that is not at all the case. There are no winners when it comes to the issue of doping: every case, irrespective of its characteristics, is always a case too many."
CAS said it would rule later on a request by UCI to fine Contador $3.25 million.
CAS secretary general Matthieu Reeb said the doping offense was "not contested," only the explanation for how the clenbuterol got into Contador's system.
"It is just the application of the rules, the fact that there was a positive test," Reeb told reporters. "In the end, it is not so spectacular. There is a clear decision based on a positive test. There was no reason to exonerate the athlete, so the sanction is two years."
If Contador appeals to the Swiss Federal Tribunal, the court can decide the legal process was abused but would not examine the merits of the evidence. A federal appeal process typically takes several months, though the court rarely overrules CAS.
Contador tested positive on the July 21 rest day. The positive results were not confirmed publicly until September 2010, when the UCI announced it had provisionally suspended him pending an investigation by Spain's cycling body.
Contador was originally cleared last February by the Spanish cycling federation's tribunal, which rejected a recommendation to impose a one-year ban. Days earlier, then Spanish Prime Minister Jose Luis Rodriguez Zapatero said on Twitter that there was no reason to punish the rider, who is idolized in his country.
"The fault is with the institutions that haven't served their purpose and who haven't been able to review a case like this," Contador said of his case, nearly one year ago. "It's been six months of sleepless nights, pulling your hair out - there are times when I cried."
After the UCI and WADA appealed the Spanish verdict, a twice-postponed hearing was heard by CAS in November.
The four-day session almost ended in chaos as lawyers for the UCI and WADA considered walking out when the panel chairman, Israeli lawyer Efraim Barak, prevented one of their expert witnesses from being questioned about the science of blood doping and transfusions.
Contador attended the closed-door hearing, which ended with him making a personal plea of innocence to the arbitrators. The panel also included German law professor Ulrich Haas, nominated by Contador's side, and Geneva-based lawyer Quentin Byrne-Sutton, selected by the UCI and WADA.
The complex 18-month legal case has also raised questions about the status of clenbuterol in anti-doping rules and the honesty of Spanish farmers. The drug is banned in Europe.
Contador is under contract to ride in 2012 for the Danish team Saxo Bank.
Team spokesman Anders Damgaard said the team was studying the ruling before making any comment.
Team owner Bjarne Riis admitted in 2007 that he had used the performance-enhancing drug EPO during his career, including when he won the 1996 Tour de France.
Logothetis reported from Madrid, Dunbar from Lausanne. Jan Olsen contributed from Copenhagen, Denmark.