The spiked ceiling is triggered when the Idol is lifted from its plinth, as heavy stone doors slide shut to trap the Spelunker in the tall chamber.
The spikes will descend slowly until they meet the ground, and will kill any character and crush any items caught beneath them.
If a hole is made in the floor (due to an explosion for example), the spiked blocks will continue to descend through the hole until they meet something solid.
To escape with the Golden Idol, you will need to have some method of destroying blocks, such as a bomb or a mattock.
You can destroy the ceiling pre-emptively by throwing up sticky bombs (or a cooked bomb), but this won't aid in your escape from being closed in the room.
The best strategy is to take the idol, then immediately place a bomb on either side of the room, blowing open the stone door and allowing you to get free before the spikes reach the ground. You can save on bombs by bringing a mattock into the chamber with you, but the trap should never be activated if you have no means of breaking free.
It is also possible to place a push block in the doorway before retrieving the Idol, which prevents the door from closing fully. You can then push the block away and the door will remain half-open, but this obviously requires a conveniently placed push block.
TriviaThe obligatory booby trap cliché that is the 'inescapable descending spikes of death' is a reference to the trap popularised in Indiana Jones and the Temple of Doom, the thematic inspiration for Spelunky.
The Idol will be found in a small square chamber that appears empty.
However, as soon as the Idol is lifted, heavy stone doors slide shut on either side and a spiked ceiling slowly descends to crush Spelunky Guy.
If a hole is blown in the floor, be aware that spikes will descend through the hole until they hit something solid.
It is also possible to place a Pushable Block in the doorway before retrieving the Idol, which prevents the door from closing fully. You can then push the block away and the door will remain half-open, but this obviously requires a conveniently placed push block.
Note that the underside of the block ceiling of this trap always deals death when contacted, even before the spikes have been revealed.
If you touch the underside while flying with a jetpack or exploring with climbing gloves, you will be killed in spite of its harmless appearance.