The airworthy fighter, based at Imperial War Museum Duxford, is one of only two left in the world to have been restored to its original specification.
The aircraft was shot down over Calais in 1940 and discovered when its wreckage was exposed by the tide.
The money will go to the RAF Benevolent Fund and Oxford University's Wildlife Conservation Research Unit.
Spitfire P9374 was donated by the American philanthropist Thomas Kaplan and his wife.
He said they were "overwhelmed and thrilled" with the sale price at Christie's in London.
The Mk I Vickers Supermarine Spitfire was originally piloted by Old Etonian Flying Officer Peter Cazenove during the evacuation of Dunkirk.
Despite saying on the radio, "Tell mother I'll be home for tea," he was shot down on 24 May 1940, crashed on the Calais coast and was captured.
He ended up in the Stalag Luft III prisoner of war camp, where British airmen launched their famous Great Escape in 1944.
But despite failing to escape, he survived and returned to the UK after the war.
The plane remained hidden in the sandy beach of Calais until the 1980s.
However, it was not until the parts were bought by Mr Kaplan and shipped to the UK that the task of restoring it began at the former home of RAF Duxford, in Cambridgeshire.
The plane was sold on the same day that The Duke of Cambridge visited Duxford to see a second Spitfire, which was restored alongside the P9374.
Mr Kaplan said: "When we all embarked upon this project, it was to pay homage to those who Churchill called "the Few", the pilots who were all that stood between Hitler's darkness and what was left of civilization.
"Today's events are, more than anything else, concrete gestures of gratitude and remembrance for those who prevailed in one of the most pivotal battles in modern history. "
Christie's said the sale broke the world record price for a Spitfire sold at auction, which was £1.7m in 2009.
BBC iWonder: Why do we love the Spitfire?
An RAF World War Two Spitfire painstakingly restored over five years, has sold for £3.1m at auction.