The 4-5 favourite, trained by John Gosden, hit the front with two furlongs to go and accelerated away to win by 10 lengths from Nayef Road (11-1) and Cross Counter (7-1) in soft conditions.
Stradivarius was only the third horse in the Gold Cup's 213-year history, after Sagaro in the 1970s and four-times winner Yeats (2006-09), to complete a hat-trick in Ascot's flagship race.
"Even with no crowd I'm quite emotional. It's a very proud moment," said Dettori. "The rain this morning was against him but I was surprised when I looked over my shoulder and everyone was in trouble and he just took off.
"Maybe we’ll come back next year to try and equal Yeats’ record.
"I have ridden some great horses but he'll go down as one of the great stayers...I'm very proud of the horse, he's been phenomenal, he gives people so much joy," added the Italian. (Reporting by Alan Baldwin, editing by Ed Osmond)