When probes fly to Mars, they must adjust their trajectories multiple times during transit to ensure correct orbit insertion. They fire their small onboard rockets a little bit to do this.
But how do probes know exactly by how much to reduce their velocity and by how many degrees to deviate to ensure they hit the right position in the Martian atmosphere for precise entry? Especially since both Mars and the probes are moving very fast. And since controllers usually have a specific location on Mars they want to target.
There's obviously no GPS in space, and looking at the stars might be a good way to understand your general position in space but I doubt it would provide a precise measurement of distance down to a few hundred kilometers.
So how are precise course corrections performed in space?