Firstly report the loss or theft by denuncia (formal statement) to your local Police or Guardia if easier.
Then obtain a certificado de antecedentes from Trafico (this shows the history of ownership of the vehicle etc), take that with the vehicle to your nearest ITV testing station and request a duplicado de la ficha tecnica (log book) (also have the vehicle ITV’d if it is not already done or is about to run out) be warned the new ficha tecnica can take weeks to come back! – however if you have got the Police Denuncia and the vehicle has passed ITV then you are fine to drive while sorting everything out.
Once the new ficha tecnica arrives (and the ITV sticker for your windscreen if you had to do the test at the same time) then its back up to Trafico to obtain a new Permiso de circulación.
Replacing Car Documents is a costly and time-consuming process so whilst you are obliged to have all original documents in the car with you when you are driving, some people prefer to take them with them when they leave the vehicle anattended. At the very least you should have photocopies kept in a different place to the originals as this will help when making your report to the Police.