A bit more detailed answer:
JPEG works by changing each 8x8 pixel block in the image into frequency domain (using discrete cosine transform, if you want to look it up). These frequencies have amplitudes. Before they are compressed, the JPEG compressor divides the amplitudes with a value and saves that value to the file. It's an integer division, so it loses information.
Pretend there's a 2x2 pixel image. When converted to frequency domain, its amplitudes might be something like
37 36
30 21
If you divide all these values by 1 before compression, you have lossless compression, since when you decompress, you get the exact same values back.
If you (integer) divide all these values by 2, they become
18 18
15 10
And when you decompress the file, by multiplying the saved values by 2, you get
36 36
30 20
These are not exactly the same values as were put in, so the compression becomes lossy.
Divide by 10 and you get
3 3
3 2
Which becomes
30 30
30 20
upon decompression, which is already quite a significant difference to the original. On the other hand, the preprocessed data contains a lot of repetition (3, 3, 3, 2), which is easy to compress, so the file becomes smaller.
That is what the JPEG quality option does on a technical level. Smaller quality values = bigger divider = more quality loss.