it is not gps it is triangulation through cell towers.
it basically works the same way as GPS but on the ground
in essence your cell talks to the towers on a constant basis. At any time it is talking to several towers.
let's assume you can see 3 towers (there could be more and the more there are the more precise the pin point) call them A, B and C and we draw their respective areas. Like this venne diagram
if C and A receive your transmission but B does not, then you are in area 6. It also has the advantage that a cell tower (like your phone) can determine strength. so if C is receiving a stronger signal then A you know it is closer to C then A.
The weakness is that the signals are not even like the venne diagram. On the other hand you tend to be “touching” more then three towers.