Type the following into a terminal:
$defaults write com.apple.dock persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }
$killall Dock
The separator will appear next to the last permanent application in your dock. Drag them around to where you want them! Run it again for another separator. To get rid of a separator right click it and select “Remove from Dock.”
