@izzy both, kinda, with additional stuff
NASA tracked the thing from the ground for most of the flight and radioed highly accurate location data over to the astronauts for them to punch into the computer
It also had an inertial measurement unit which is a bunch of gyroscopes and accelerometers that tracked how far it thought it had gone and in what directions
Also, they used sextants, just like sailors used to