Tuning The Spin Transport And Magnetic Properties Of 2D Materials At The Atomic Scale