Difficulty

Difficulty can be toggled via the Options menu in Minecraft. Changing this option has a direct impact in the gameplay itself. No setting impacts the quantity of hostile mobs that spawn, including peaceful. There are currently four difficulties in the game.

Hardcore difficulty
Hardcore Mode causes the player to spawn in Hard mode and does not allow the difficulty to change. If the player dies, the world is deleted. To play this mode, change the game mode to it when you start a new world.

Tips
If you are having trouble getting started or exploring caverns, the best thing to do is change the difficulty to "Peaceful". You will be able to explore caves or build a base/HQ much more easily. However, this does not give you the full experience, and you will have to turn the difficulty up if you want to get all the items and tools, such as the bones to make bone meal. In all versions since the 1.8 beta Adventure Update, you may also find cobwebs, that, when destroyed with a sword, give you String. A good recommendation is to turn on Peaceful during the day, and then turn the difficulty back up at night IF you are prepared. This way, you can get the benefits of both ways to play.

Another idea is to change to peaceful whenever you venture into a cave, then turn it back up whenever you leave and go outside or to your house. That way you encounter the enemies above ground at night, but you don't have to worry about a creeper suddenly exploding or a skeleton shooting at you from dark corners when you go into a cave or dying from hunger while mining (many actions performed while mining will make you very hungry, going into a cave without enough food on hard difficulty can easily end in death).

It can be difficult to get your feet wet if you are constantly attacked when first entering The Nether (particularly since some computers can freeze when switching between the two areas), so changing the difficulty to Peaceful will stop the Ghasts attacking you. Alternatively, standing inside the portal will protect you from being seen by mobs or hit by other players while the lag stops. This also works on servers where cheating by altering the difficulty is impossible.

In the Nether, difficulty does not affect hostile mob spawning in any way, with the exception of hostile mobs not spawning at all in Peaceful.

On servers 0 difficulty is Peaceful, 1 is Easy, 2 is Normal, and 3 is Hard.

Strategy for hardcore mode: food is of the utmost importance, a sword is next, shelter (most importantly a bed) is third and armor is next.

Trivia

 * Notch made a tweet on October 22nd 2010, stating that he's "changing difficulty to realism. Lowest setting = creative. Highest setting = starve". This was never implemented, however "hardcore" mode was added along with a creative gamemode. Additionally, creative mode was added, making the player an invulnerable non-target, peaceful remains unchanged, easy and normal allow damage from hunger but not full starvation, hard allows one to starve to death, and hardcore mode adds permanent death.