Maciej Bodnar (Bora-Hansgrohe) covered the 22.5 killometre time trial course in the fastest time of 28 minutes and 15 seconds.
The Polish rider had an arduous three hour wait in the hot seat as he saw many attempt to wrest away his stage victory, including compatriot Michal Kwiatkowski who finished just one second behind.
Later, Contador clocked the same time as Kwiatkowski at the second time check on the Notre-Dame de la Garde and looked a chance for the stage win. But the determined Spaniard lost time in the second section and finished the stage in sixth place, 21 seconds behind Bodnar.
“I can't believe it," Bodnar said. "Last year I was close to win a stage and this year I'm even closer. I'm really happy.
"I've spent three hours waiting in the stadium. The atmosphere was amazing. I was feeling good today in the race, then Kwiatkowski threatened me but didn't beat me.
"I was waiting for Froome, knowing that he's really good in TT. It's a huge victory for me.”
[tdf widget="stagewinners" stage="20"]
The only other real challenger to Bodnar's time was the race leader himself who came home six seconds behind the Pole's position.
“I'm speechless," Froome said. "It's just an amazing feeling. It was so close coming into this TT, I just spoke to my wife and I'm going to Paris tomorrow with my son.
"This was my closest Tour de France, the more hard fought between the riders on GC. I didn't think it would come down to this TT in Marseille but it did.
"There were a bit of pressure, but for me, it's always a good thing having pressure. I'm delighted with winning again.”
Romain Bardet had to fight to keep his third place on the podium as he bled second after second in a poor time trial performance. He finished one minute and 57 seconds behind Froome, and after Mikel Landa's 15th place on the stage, needed to beat the time of 30 minutes and 19 seconds to keep his third podium place over the Sky domestique. The Frenchman did it by one second.
"I'm exhausted, I'm shattered," Bardet said. "I gave everything I had.
"It's the Tour de France, some days you feel good, some days you don't. Today I didn't feel well. For a few days I had not been feeling well in terms of my health. I paid the price."
"I could feel from the start that I was not in contention. I was only thinking of making it to the line as quickly as possible. I know my body well.I know when I'm good or not. I was forced to ride with my head.
Rigoberto Uran fared better finishing the stage in eighth position and 31 seconds behind Bodnar. The Colombian heads to Paris with a deficit to Froome of 54 seconds.
[tdf widget="tourleaders" stage="20"]