A constellation of clocks
GPS is a fleet of satellites — the United States system keeps at least 24 working, orbiting about 20,000 kilometres up. Each satellite carries atomic clocks and broadcasts a steady stream of signals saying exactly where it is and the exact time the signal left.
Your phone listens silently — it transmits nothing to the satellites. It simply notes when each signal arrives. Since the signals travel at the speed of light, even a tiny delay means a long journey: each nanosecond of travel time equals about 30 centimetres of distance.
Circles that meet at you
From one satellite's timing, the receiver knows its distance from that satellite — it lies somewhere on a sphere of that radius around it. A second satellite narrows the position to a circle; a third, to two points; a fourth signal also corrects the receiver's cheap, imperfect clock.
That fourth measurement is the quiet genius of the system: your phone's clock is far too rough for nanosecond timing, so the maths solves for the clock error as well as the three position coordinates, borrowing the satellites' atomic precision.
Metres from microseconds
The timings involved are around a fifteenth of a second — the time light needs to travel down from orbit — measured to billionths of a second. Get the timing right and the position lands within a few metres, anywhere on Earth, free to use.
The signals are astonishingly faint by the time they arrive — weaker than the background radio noise around them — yet receivers pick them out by recognising each satellite's distinctive repeating code, like hearing a familiar voice in a crowd.

