It shares the same root, but it isn't the same word. "Negro" in spanish means the color black. It might or might not be used to refer to race, just like "black" might or might not be used to refer to race. To clarify, "black" usually translates as "negro". Meanwhile, "n-er" usually translates as "negro" followed by an offensive adjective.