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. The spelunker can whip or jump on enemies to defeat them, pick up items that can be thrown to either attack enemies or set off traps, and use a limited supply of bombs and ropes to navigate the caves. Levels are randomly generated and grouped into four increasingly difficult "areas", each with a distinctive set of items, enemies, terrain types and special features. Later areas contain better treasures, secret locations, and items. However, if the player loses all their hearts or runs into an instant kill trap, they will have to start from the beginning.
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 artifacts. 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.
The Xbox Live Arcade version of the game features local multiplayer (co-op and deathmatch) for up to four players. There are 9 different characters to play as.
Spelunky also includes a level editor, in which players can create their own non-random levels to share with others.