Contador is set to win the Tour de France
Contador holds a 23-second lead over Cadel Evans, which should give the Spaniard his first Tour win on Sunday.
The 24-year-old Contador's team-mate Leipheimer took the stage in a time of one hour, two minutes and 44 seconds.
Leipheimer's superb ride - his first Tour stage victory - put him just nine seconds behind the Australian Evans.
I knew I had to give everything to retain the jersey
Alberto Contador
In winning the stage the American clocked an average speed of 53.082km per hour in the 55.5km stage from Cognac to Angouleme.
"I feel this is maybe the best day of my life," said Leipheimer. "It's my first Tour de France stage win and after this I think I deserve to stand on the podium in Paris."
At the start of the stage Evans trailed Contador by nearly two minutes but the Australian, turning an enormous gear, gradually chiselled away at the Spaniard's lead.
"I've done all I could," said Evans.
"I lost 55 seconds in the ascent of the Col de Peyresourde - that is where I lost the Tour," the Australian added, referring to one of the climbs in the Pyrenees in Wednesday's 16th stage.
Contador admitted his hold on the yellow jersey was severely threatened by Evans.
"Thirty kilometres from the finish I only had a 38-second advantage and it was at a time my legs were really hurting," said the Spaniard.
"I was worried. I knew I had to give everything to retain the jersey - it wasn't easy."
Watched on Saturday by seven-times Tour winner and former Discovery Channel rider Lance Armstrong, Contador is set to become the first Spaniard to win the Tour since Miguel Indurain's fifth victory in 1995.
Leipheimer said of Armstrong's visit: "He's normally very calm and collected but he was nervous.
606: DEBATE
"It brought back memories. He was taking care of little details, he was helping, asking if we needed anything. He was very much into the groove of what we were doing."
Leipheimer added: "We've won this Tour and have two stage wins. I'm not going to attack Cadel on Sunday. He's a better sprinter anyway."
About to become the Tour's youngest winner since Jan Ullrich in 1997, Contador will be the first pure climber to secure victory in the race since Italian Marco Pantani triumped in 1998.
Until Thursday Contador had been second in the race, but the Spaniard profited from former leader Michael Rasmussen's dismissal by his Rabobank team on Thursday for lying about his training whereabouts.
Pre-race favourite Alexander Vinokourov was also expelled after testing positive for blood doping following his victory in the Albi time trial last weekend in a race that has been marred by continued drugs revelations.
Stage 19 result
1 Levi Leipheimer (US) Discovery Channel 1hr, 2mins 44sec
2 Cadel Evans (Aus) Predictor-Lotto +51 sec
3 Vladimir Karpets (Rus) Caisse d'Epargne +1:56
4 Yaroslav Popovych (Ukr) Discovery Channel +2:01
5 Alberto Contador (Spa) Discovery Channel +2:18
Selected others
62 Charles Wegelius (GB) Liquigas +6mins 41secs
87 David Millar (GB) Saunier Duval-Prodir +7.53
107 Geraint Thomas (GB) Barloworld +8.39
Overall standings
1 Alberto Contador (Spa) Discovery Channel 87hr 9mins 18secs
2 Cadel Evans (Aus) Predictor-Lotto +23 sec
3 Levi Leipheimer (US) Discovery Channel +31
4 Carlos Sastre (Spa) Caisse d'Epargne +7:08
5 Haimar Zubeldia (Spa) Euskadi +8:17
6 Alejandro Valverde (Spa) Caisse d'Epargne +11:37
7 Kim Kirchen (Lux) T-Mobile +12:18
8Yaroslav Popovych (Ukr) Discovery Channel +12:30
9 Mikel Astarloza (Spa) Euskadi +14:14
10 Oscar Pereiro (Spa) Euskadi +14:25
Selected others
45 Charles Wegelius (GB) Liquigas +1hr 46min 15sec
69 David Millar (GB) Saunier Duval-Prodirr +2:32.12
140 Geraint Thomas (GB) Barloworld +3:46.05
__noTOC__
2005 Tour de France. 
Levi Leipheimer of United States has won stage 19 of the 2007 Tour de France in a time of 1h 2' 44".

"I feel this is maybe the best day of my life," said Leipheimer. "It's my first Tour de France stage win and after this I think I deserve to stand on the podium in Paris."

Alberto Contador of Spain keeps the yellow jersey. He is now only 23 seconds ahead of Cadel Evans, who took second place in this 55.5 km individual time trial stage.

Leipheimer is in third overall, only 31 seconds behind Contador and 8 seconds behind Evans. When were the top three this close heading into the final stage? As close as it is, there will probably be no change at the top tomorrow.

"I've done all I could," said Evans. "I lost 55 seconds in the ascent of the Col de Peyresourde - that is where I lost the Tour," he added, recalling stage 15.

"I'm not going to attack Cadel on Sunday. He's a better sprinter anyway." said Leipheimer, who seems to enjoy that his team Discovery Channel Pro Cycling has almost certainly won, not only the yellow jersey for Contador, but also the team classification where they hold a massive advantage. "We've won this Tour and have two stage wins," he said.