In OS X Mavericks, Apple has changed the behaviour of the sleep button.
This is kind of annoying, so I was extremely happy to discover that you just need to issue this command in Terminal and restart your Mac to get the old behaviour back:
defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no
After running this command, it’ll take 2–3 seconds before the OS X shut down message pops up on your screen.