Updated for RetroPie v2.3 (Porta Pi OS v4.x)
This section will show how-to configure a compatible USB controller for your RPi. I've tested a few controllers with great success. The hardest part is learning the button assignments; meaning buttons that have face labels X, Y, A, B, Start, L2... are assigned to the computer as generic buttons ID's like "button 1", 2, 3, 4 and so on (see diagram at the bottom of page).
USB Controllers I've tested successfully:
Power A X360 (3rd party)
DreamGear PS3 Gampad (3rd party)
Chinese controller from DX.com
Load a rom. Press F1 on your keyboard.
If your joystick is compatible with your Raspberry Pi, it will show up in the “Device” section. Go to Settings>Input Options> Configure All and then follow the step-by-step prompts. Press the corresponding buttons on your controller to map them to the appropriate functions. Done.
Map your controller in Emulationstation:
While in emulationstation open up the menu (usually by pressing Enter if you follow my guides or my images)
Go to "Configre Input". Follow the on-screen steps. Done!
Here's a diagram showing how the Xbox buttons are referenced.