Surprisingly, the number of spacecraft manufacturers is quite large. However, as you probably know, Elon Musk's SpaceX is one of the most recognizable. But there are quite a lot of them here is a list of spacecraft manufacturers. They use a combination of methods to accurately determine the speed and position of its spacecraft in space. Here are just a few that we can learn about from public announcements.
GPS
Well yeah, such things are also useful in space. Some of SpaceX's spacecraft, such as the Dragon capsule, are equipped with GPS receivers. These receivers can determine the spacecraft's speed by comparing its position to known positions of GPS satellites.
Doppler Shift
Spacecraft could use radio signals to measure the Doppler shift, which is a change in frequency caused by the motion of the spacecraft relative to the Earth. By analyzing this shift, spacecraft can determine it's speed.
Inertial Measurement Units
IMUs are sensors that measure the acceleration and rotation of a spacecraft. By integrating the acceleration over time, spacecraft can determine the it's speed.
Optical Navigation
SpaceX also uses cameras and other optical sensors to track the position and speed of its spacecraft relative to other objects, such as the Earth or the Moon.
🚀 Try to pilot a spaceship
Here we have something interesting. Some time ago SpaceX created ISS Docking Simulator and try to pilot SpaceX Dragon 2!