Yes a GFCI works on a non-grounded circuit.
GFCI's are actually very simple devices. The principle si pretty straight forward.
If current goes out to the appliance on the HOT it should return on the NEUTRAL, in this situation all is good.
When current goes out on the HOT and only some returns on the NEUTRAL it means rest of the current went to ground. This is a problem. If you become part of the path to ground you will get a shock, possibly fatal.
The concept is so simple I don't know why no one thought of it 75 years ago.
They sell GFCI or ELB (earth leakage breakers) breakers here but I have never seen a GFCI receptacle here. In Canada I had a GFCI receptacle as the first device in the chain. It protected everything downstream