The young man had apparently planned to connect two holes more than two metres deep with a tunnel, but the sand collapsed around him, trapping him up to his neck for almost two hours.
His girlfriend called emergency services, who rushed to the scene in a helicopter and managed to pull the man out uninjured with the help of other nearby beachgoers.
"He had built a three-metre (10-foot) deep hole when the sand buried him," a Tenerife fire department spokeswoman told news agency AFP, adding that five vehicles and 15 fire fighters were involved in the rescue.
Spanish newspaper Diario de Avisos charged the vacationer with stupidly endangering himself and forcing the massive rescue operation.
“Foolishness cost the Canary Islands taxpayers €20,000,” the paper wrote.
In July a 12-year-old Swiss boy died after a tunnel he dug in sand dunes with his two brothers at a beach at Castello d'Empuries in northwestern Spain collapsed around him, AFP reported.