A sequence per "series", where a series can be a fiscal year, a department or category, etc. But I am not sure if you can have one series per customer, I only find conflicting information.
You can have more details here, in the section "Complete invoice":
You can have more details here, in the section "Complete invoice":
https://sede.agenciatributaria.gob.es/Sede/en_gb/iva/factura...
https://www.boe.es/buscar/act.php?id=BOE-A-2012-14696#a6 (Spanish only)