Traffic regulations regulate the documents that every driver must have in order.

The General Regulations for Drivers and Vehicles in Spain establish the mandatory documents that drivers must carry with them when driving. These documents include the driving license, the technical inspection card and the certificate of technical characteristics in the case of mopeds. In addition, Royal Decree 818/2009 establishes that drivers must carry their driving license or permit with them at all times.
Often, the question arises as to whether it is legal to drive without carrying a license and replace it with the Documento Nacional de Identidad (DNI). Although both documents are issued by the Spanish government, they do not have the same legal effect. Therefore, the answer is no. It is compulsory to carry the driving license and it is grounds for a fine if this rule is not complied with.
Fines for not carrying a driver's license may vary. If an officer requests the license and it is not carried, the fine can be 10 euros for a minor infraction. If the license data is not up to date or is incorrect, the fine can be up to 80 euros. In the case of carrying an expired license, the penalty will be 200 euros. If you dare to drive when your license has been withdrawn, the penalty will be serious, with a fine of 500 euros and the withdrawal of 4 license points.
Format
It is true that law enforcement officers can check if a person has a driving license through the database of the Dirección General de Tráfico, but this does not exempt from carrying the driving license. In addition, the law also requires to carry with you the vehicle's Driving License and the Technical Vehicle Inspection (ITV) card.
The law does not specify how these documents should be carried, so it is possible to carry the driving license in both physical and digital format through the MiDGT application, which also includes the Driving License. However, not all law enforcement agencies have QR code readers to read this information, so it is recommended to carry both formats at all times.
Source: El Día