If you buy a second hand car from a garage, whether it´s a dealer of just the brand of your car, of a ´multi-brand´ seller, you should be offered a guarantee period of 1 year, as stated in the Consumer Protection Law.
If you buy from a private person, you are not protected by Consumer Protection Law, but the Código Civil does have a section that applies to private sales, as of article 1445.
Articulo 1474 En virtud del saneamiento a que se refiere el artículo 1461, el vendedor responderá al comprador:
1. De la posesión legal y pacífica de la cosa vendida.
2. De los vicios o defectos ocultos que tuviere.
Meaning that the sold article/car must be the seller´s legal property in the first place and that it will be up to the seller to take care of any ´vicios´ or hidden defects at the time of the sale.
El vendedor estará obligado al saneamiento por los defectos ocultos que tuviere la cosa vendida, si la hacen impropia para el uso a que se la destina, o si disminuyen de tal modo este uso que, de haberlos conocido el comprador, no la habría adquirido o habría dado menos precio por ella; pero no será responsable de los defectos manifiestos o que estuvieren a la vista, ni tampoco de los que no lo estén, si el comprador es un perito que, por razón de su oficio o profesión, debía fácilmente conocerlos.
The seller will be obligated to take care of the repair of any hidden defects (or reimburse the buyer), if they prevent the article to be used as it should, of if they limit its use in a manner that, would the buyer have known, he would not have bought the article, or only at a lower price. But the seller will not be responsible for any obvious or easily observed defects, or for those that are not as easily detected by a regular buyer, but in case the buyer is a technical expert who for reason of his profession or job, should be expected to be detected easily.
Artículo 1485 El vendedor responde al comprador del saneamiento por los vicios o defectos ocultos de la cosa vendida, aunque los ignorase.
The seller will take care of the repair (or reimburse the buyer the repair costs) of any ´vicios´ or hidden defects, even if he was not aware of them.
Esta disposición no regirá cuando se haya estipulado lo contrario, y el vendedor ignorara los vicios o defectos ocultos de lo vendido.
This disposition is not in force when the contrary has been argumented/contracted and the seller wasn´t aware of the ´vicios´ or hidden defects of the article sold (e.g. sold ´as is´).
Artículo 1486 En los casos de los dos artículos anteriores, el comprador podrá optar entre desistir del contrato, abonándosele los gastos que pagó, o rebajar una cantidad proporcional del precio, a juicio de peritos.
In view of the previous articles, the buyer can opt to desist the sales contract, return the money paid, or demand a partial refund, proportionate of the previously hidden defect. Technical experts should rule on the relevant proportionate amount. The law doesn´t mention a window to exercise your right to desist the sale, but under Consumer Law this would be 14 days.
According to the consumer organisation OCU, the guarantee period on private sales is 6 months, optionally to be augmented to a full year by an extra insurance policy, covering this risk (between 200 and 500 euros, to be contracted by the buyer).
In practice, to prove your case, you would need at least the written declaration of a qualified mechanic and, if the seller is not ´de buena fe´ meaning he or she was aware of some not so easily detected defects but chose not to inform the buyer he will not readily respond to his legal obligations when confronted with a claim about hidden defects from the buyer and you might have to take him to court to get things settled in your favour.