(CNN) -- Kids dig in the sand at the beach all the time, but the fun nearly turned fatal for an 11-year-old Pennsylvania boy this week.
The 11-year-old was given CPR and revived before being taken to a local hospital.
The boy was digging a tunnel with friends on a beach in Ocean City, Maryland, on Tuesday when part of it collapsed on top of him, authorities said.
Lifeguards rushed to pull him out, but it first appeared that they were too late. The boy was not breathing, and he had no pulse, Beach Patrol Capt. Butch Arbin told CNN on Wednesday.
But rescue crews revived the boy by performing CPR, said Arbin, who was at the scene.
There was a lot of emotion on the beach when the boy's pulse came back, he said.
"He basically went from dead to life," Arbin said, adding that the boy's mother called the rescue a "miracle."
As he was being rolled into an ambulance on a stretcher, the boy -- perhaps not realizing the trauma he had just survived -- complained to his mother that he had sand in his eyes, Arbin said.
The child, whose family did not want to be identified, was initially taken to Atlantic General Hospital and later flown to the A.I. DuPont Hospital for Children in Delaware, he said.
He's recovering there and probably will be released later Wednesday, Arbin said.
All About Ocean City