Porcupines with quills are less likely to be eaten by predators, and have greater reproductive fitness than those without quills.
Quills are an adaptation that reduces the risk of predation for porcupines.