To add a “space” to the dock in OS X, open up Terminal.app and enter this command.
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
Enter it as many times as you want spaces. If you enter too many times, no fear, they are easy to remove.
The spaces will not show up until you restart the Dock with the following command:
killall Dock
To remove unwanted spaces, just drag them up and out of the Dock like any other icon. To move them around, click and drag.
Complete command can be found on GitHub.