The Spaniard finished safely in the pack on the Champs Elysees to preserve his 39-second lead over Andy Schleck, with Russian Denis Menchov in third.
Cavendish produced a spectacular finish in the last 100m to pip Alessandro Petacchi, who took the green jersey.
Seven-time winner Lance Armstrong, 38, completed his 13th and final Tour.
Cavendish was overjoyed at winning his fifth stage of the Tour, his 15th in total, becoming the first man ever to seal back-to-back wins on the Champs Elysees.
“You have got to be happy with just one stage win at the Tour de France,” said the 25-year-old from the Isle of Man. “It is the hardest and biggest bike race in the world and you have to show respect for it.
“After the first week it was looking further and further away but the team kept going. They didn’t change the plan or give up, they put the general classification chances on hold and we finally got the first win.
“Then you get on a roll, you get momentum and that gives you more confidence. That is how it works.
“This is the pinnacle. For me it is the most beautiful finish in the world, an icon of the sport, and to win it is pretty spectacular.
“It is the perfect ending to the Tour and and I am looking forward to celebrating now.”
Cavendish began the stage with a chance of taking the green jersey, but as a result of Petacchi finishing in the top six, the sprinter was denied the honour, finishing with 232 points to the Italian’s 243.
“I’m disappointed this year not to win the green jersey,” the Manxman added.
“I set it out as my target and I had some bad luck in the first days and went out of the running.
“But we fought back. We did our best. I’ve lost it by 11 points but we’ve won five stages and we’re happy with this year’s Tour.”
Green jersey winner Petacchi is the most successful active rider with 155 victories and joined a select list of sprinters who have won the green jersey in all three Grand Tours – including the Giro d’Italia and the Spanish Vuelta.
The last man to do so was France’s Laurent Jalabert in 1999.
His 46 stage wins in the three majors is only surpassed by his compatriot Mario Cipollini, who won 57 stages. Petacchi also became the first Italian to take the green jersey at the Tour de France since Franco Bitossi in 1968.
The first part of the 102.5km final stage from Longjumeau to Paris saw Contador respect the traditions of champagne sipping and posing for the photographers on motorbikes.
It was not until the peloton arrived in Paris that the race began, with eight laps of the 7km Champs-Elysees circuit awaiting them.
With seven laps remaining, a group of 11 riders broke from the peloton, but with one lap to go that group was reduced to three.
The brave cluster was then swallowed up by the peloton with the main teams protecting their sprinters before the final burst for glory.
Quick Step’s Carlos Barredo, Cervelo Test Team’s Thor Hushovd, Lampre-Farnese’s Petacchi and Garmin’s Julian Dean all made a bid, but they could not live with the pace of Cavendish who swung to the right with about 100m to go and accelerated to the line.
It was another devastating display of sprinting by Cavendish, who became the first rider to win in Paris two years in a row.
The moment may have belonged to Cavendish, but the day and Tour was Contador’s.
“I had some tough moments on this year’s race, as much from a mental as physical point of view,” said the 27-year-old, who extended Spain’s winning streak in the race to five years.
“I think that managing to cope during those days was the reason I won the Tour. I suffered a lot to get this result. Words don’t explain what it means to me.”
Runner-up Schleck, 25, took the white jersey awarded for the best young rider, while Armstrong’s Team Radioshack were the leading team at the Tour.
French Bbox rider Anthony Charteau claimed the King of the Mountains title.
Before the start of the stage, 38-year-old Armstrong and his team-mates were ordered to remove their change of jersey highlighting cancer sufferers because it fell foul of Tour rules.
The team were fined a total of 6,300 Swiss francs for the incident.
“The idea was to talk about the significance of the disease,” said the American.
“I suppose in the end changing the jerseys probably brought more attention, so maybe it was a blessing. But it was stressful at the time.”
Stage 20 results:
1. Mark Cavendish (GB/HTC Columbia) 2h 42m 20s
2. Alessandro Petacchi (Ita/Garmin) same time
3. Julian Dean (NZ/Garmin) same time
4. Jurgen Roelandts (Bel/Omega) same time
5. Oscar Freire (Spain/Rabobank) same time
1. Alberto Contador (Spa/Astana) 91hrs 58mins 48secs
2. Andy Schleck (Luxembourg/Saxo Bank) +39″
3. Denis Menchov (Rus/Rabobank) +2’01”
4. Samuel Sanchez (Spain/Euskaltel) +3’40”
5. Jurgen Van den Broeck (Bel/Omega Pharma-Lotto) +6’54″”
15. Nicolas Roche (Ire/ AG2R) +16’59”
17. Thomas Lovkvist (Swe/ Sky) +20’46”
23. Lance Armstrong (US / Radioshack) +39’20”
24. Bradley Wiggins (GB / Sky) +39’24”
26. Cadel Evans (Aus/ BMC) +50’27”
67. Geraint Thomas (GB / Sky) +2h 05’00”
151. Stephen Cummings (GB / Sky) +3h 45’47”
154. Mark Cavendish (GB / HTC-Columbia) +3h 51’23”
158. David Millar (GB / Garmin) +3h 56’46”
163. Jeremy Hunt (GB / Cervelo) +4h 02’21”
164. Daniel Lloyd (GB / Cervelo) +4h 02’59”