According to our current understanding of physics, an object with mass cannot reach or exceed the speed of light. However, let's assume for the sake of this hypothetical scenario that the spaceship is traveling at a velocity very close to the speed of light, but not actually equal to it.
If the spaceship suddenly turns off its engine, it will continue to move forward at the same speed, relative to its surroundings, due to the principle of inertia. This principle states that an object in motion will remain in motion with the same velocity unless acted upon by an external force.
However, from an outside observer's perspective, the spaceship's velocity would still be slightly below the speed of light. This is because as an object with mass approaches the speed of light, its mass effectively increases, requiring more and more energy to accelerate it further. So, when the engine is turned off, the spaceship's velocity relative to an observer outside the spaceship would remain slightly below the speed of light.
It's important to note that the effects of traveling at relativistic speeds, including time dilation and length contraction, become more significant as the spaceship approaches the speed of light. These effects are governed by Einstein's theory of special relativity and can have profound consequences on how space and time are experienced.