Spin density wave and electron nematicity in magic-angle twisted bilayer graphene