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
Notch said in his blog that he would add a hardcore difficulty level. The rules would be that when you die, the world is deleted and you have to start fresh with a new world. The idea came to Notch from a Minecraft gameplay blog on the PC Gamer site.

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 bow, or bones to make bone meal (unless you find a dungeon with string, then it will be possible to craft a bow). With the recent 1.8 update, you may also find cobwebs that, when destroyed with a sword, give you a 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 both the benefits of the two ways to play.

Another idea is to change it 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 in the darkness right in front of you or a skeleton shooting at you from someplace you can't see when you go into a cave.

It can be difficult to get your feet if you are constantly attacked when first entering the Nether (particularly since some computers can lag when switching between the two areas), so changing the difficulty to Peaceful will stop the Ghasts attacking you.

Difficulty does not affect hostile mob spawning in any way.

Going to the nether and bringing back netherack to put around your house and setting it on fire will keep out enemies. Note: If your house is made from wood it will burn.

Trivia

 * Notch made a tweet on October 22nd 2010, stating that he's changing "difficulty" to "realism". Lowest setting = creative. Highest setting = starve.
 * As of Beta 1.3, fewer passive mobs spawn on harder modes.