Players control an unnamed adventurer, known as the spelunker. The aim of the game is to explore underground tunnels, gathering as much treasure as possible while avoiding traps and enemies. Levels are randomly generated and grouped into five increasingly difficult "areas", each with a distinctive set of items, enemies, terrain types and special features. Later areas contain better treasures, plus secret locations (like the City of Gold) and items.
Enemies include animals like bats, snakes and spiders of varying sizes, other characters, and monsters like yeti, man-eating plants and ghosts. The player can collect many items, mainly gold and jewels which add to the player's score, but also useful objects including bombs, guns, climbing gear and archaeological artefacts. Some of the latter have supernatural abilities, including kapalas, hedjets, crystal skulls and golden ankhs, though many of these special items can only be gained through secret methods, like combining other items together. Some items may be purchased or stolen from shops scattered about the caves, though the shopkeeper becomes a powerful enemy if you steal from him.
The player can also encounter damsels in distress trapped in the caves, who can be picked up and carried to an exit. Successfully doing so returns health to the player. It's possible to unlock the damsel as a playable character; gameplay is identical, except that the player encounters spelunkers to rescue. Another unlockable character is the "Tunnel Man", who possesses a mattock instead of a whip.
Spelunky also includes a level editor, with which players can create their own non-random levels to share with others.