The record is of type TXT and looks, for example, like this: v=spf1 include:_spf.google.com ip4:203.0.113.10 ~all. The recipient's server looks at which IP the email came from and checks it against the list. The ending ~all means "don't trust the rest, but accept the email with a flag", and -all demands rejection.
A domain must have exactly one SPF record: two records break the check entirely. Another limit: no more than 10 DNS lookups through include, a, mx and similar mechanisms, otherwise the check ends in an error. SPF checks the envelope address, not the one the reader sees, so on its own it doesn't protect against spoofing. DMARC closes that gap.