This depends on the status of the driver. If the car is brought to Spain by a person who intends to stay here as resident, and wants to import the vehicle as part of his household goods (to avoid import taxes), they have to change plates within 60 days of registering as resident in Spain.
Article 65.1.d and the Disposición Adicional Primera of Ley 38/1998, of December 28th, on Special Taxes.
If you do not register as resident, but remain in Spain longer than 185 days, you are considered a normal and fiscal resident, and are subject to the Special Tax anyway. The tax is to be paid upon changing the plates to Spanish, that is what you must do by then at the latest. If stopped and checked after this date, you will be given 5 days to rectify the situation, and will receive a fine.
Nonresident can drive and keep a non Spanish plated car here for up to six months in any period of 12 months. This is tied in with the residency issue as you are considered a resident when you reside here for the same amount of time. Link with the EU Directive that states this. art. 3
Once you have registered as resident on the Registro de Extranjeros, you cannot drive a foreign plated vehicle anymore, unless it is owned by a non-resident and the owner is with you in the car. Or when you are within the 30 days window to import the vehicle, counting from the day of entry/first use in Spain or if this info is not available, as of date acquisition/ownership. See this LINK with the relevant info from the EU.
Article 1.1 of the Reglamento de Vehiculos (necessity to have obtained required authorisation for vehicle to be on the road legally)
Note: it´s the same in the UK, see our FAQ on Using a Spanish vehicle in the UK.