Spin dynamics in two-component Bose-Einstein condensates