I assume they can change the angle so the thrust vector is negative. It depends on the geometry between Earth, Mars, and the spacecraft. Or maybe they accelerate to just match the orbital velocity of Mars as they arrive.