When we refer to the three personal preventive measures of the Spanish Penal Procedural Law (in Spanish Ley de Enjuiciamiento Criminal, henceforth LECrim), we are talking about the detention, the provisional prison and the provisional liberty, the last also divided between with or without bail.
The detention and the provisional prison share a title inside the LECrim, whereas the provisional liberty has a whole title in the LECrim dedicated to regulate this personal preventive measure. Both titles are located inside the Second Book of the LECrim, but the detention and the provisional prison are in the Title VI of this book, and the provisional liberty in the Title VII. Why are they separated in this form? Evidently, I am not able to read the mind of our legislator, and sincerely I don’t know if the LECrim´s exposition of motives gives any plausible explanation, but this division objectively corresponds with the fundamental rights affected. The detention and the provisional prison affect to the right to personal liberty established in the art. 17 of the Spanish Constitution (henceforth CE), the right to freely choose a place of residence and to circulate throughout Spain (art. 19 CE), and indirectly to the right to the presumption of innocence of accused. But in the case of the provisional liberty, the right to personal liberty (art. 17 CE) is not affected, since the investigated on whom this preventive measure is applied will not be imprisoned, nonetheless the other two rights, the right to freely choose a place of residence and to circulate throughout Spain and the right to the presumption of innocence will be too affected, though in a milder way than with the detention and the provisional prison. As I said I don’t know if this is the reason of why they are separated in different titles, but it would be a good one. In other words, the detention and the provisional prison suppose the imprisonment of the investigated, and the provisional liberty the obligation of attend summons of the judge (art. 530 LECrim).
The first personal preventive measure in the LECrim is the detention. The detention is more like a tool that serves as a means to apply the other two. The detention may be carried out by a particular (art. 490 LECrim) or a police officer (art. 492 LECrim) but in both cases the arrested person should be putted at judicial disposition in 72h. since he was arrested (art. 17.2 CE and art. 520.1 LECrim), or as soon as the investigation gathers enough proofs to the clarification of the facts. The 72h. operates as a maximum period which never can be surpassed. Once the arrested person is putted at judicial disposition, will take place the audience where the instructor judge decides which of the others personal preventive measures is applicable to him (art. 505 LECrim). Therefore here is link between the detention and the provisional prison or the provisional liberty, and this is why I said at the beginning that the detention is more like a tool necessary to later apply the provisional prison or the provisional liberty. Notwithstanding don’t let it mislead you, it doesn’t mean that before the provisional prison or the provisional liberty is applied always must be first a person arrested, because the audience of the art. 505 can take place without a previous detention. 
Before we continue is necessary to explain better what is a personal preventive measure. A preventive measure is a measure destined to guarantee the effectiveness of the penal process, in the case of a personal preventive measure it will assure that the investigated is always at disposition of the judge or tribunal which is judging the crime. There is another sort of preventive measure, the real preventive measures, and they serve to assure the pecuniary responsibilities of the investigated derived from the penal process. But what have in common all the preventive measures? all of them have to be a consequence of what the jurisprudence have called “fumus boni iuris” or appearance of good right, and try to avert the denominated “periculum in mora” or danger of a delay. The appearance of good right appear when the proofs gathered pointed out to the existence of a crime, and also to a determined person as its author, of course the evidences should not have to be as strong as to destroy the presumption of innocence of the investigated, it would only be necessary in a future sentence where suspect is declared guilty. And the “periculum in mora” means that the preventive measure has to comply with a legitime legal purpose, like avoid the flight of the investigated, the destruction of proofs, or the commission of new crimes. I have explained it now because in the case of the detention this two requisites are not as visible as in the case of the provisional prison or the provisional liberty. 
The LECrim mustered these two guarantees or requisites, “fumus boni iuris” and “periculum in mora”, in the article 503 for the provisional prison. Whereas for the provisional liberty the LECrim is more open, we don’t have in any article the cases which allowed to us apply this preventive measure, we only have the art. 529 which reflect the character subsidiary of the provisional liberty with respect the provisional prison, it says, but in other words, that the provisional liberty will apply only when the judge has not applied the provisional prison. It means, that the provisional liberty will only be applicable when the requisites included in the article 503 are not met by the suspect and the crime. In other words, the provisional liberty only will be possible when the risks which justify the provisional prison are less sharp, or some condition is not met by the crime.
Although the boundaries between one measure and other are more diffuse than at first glance appear. We also have to take into account that the provisional liberty is also divided between provisional liberty with a bail or without it. The bail is considered another kind of personal preventive measure by our jurisprudence, it says that it is in the middle between the provisional prison and the provisional liberty without bail. The purpose of the bail is again to reassure the subjection of the investigated to the process, so it doesn’t serve to guarantee pecuniary responsibilities derived from the process as the real preventive measures. Hence the amount asked by the judge to comply with this obligation, never can be as high as to make the possibilities of liberty of the investigated unreal, it has to be proportional to the gravity of the crime and to the means available to the investigated to pay it. Of course, as I have hinted, the consequence of a bail not paid is that, the provisional liberty with bail is automatically transformed into a provisional prison without conditions.
The distinction between the provisional prison and the provisional liberty with bait is not also clear if we think in the audience of the art. 505 LECrim. This audience will be only necessary when the judge decided some of these preventive measure, therefore the provisional liberty without bail is an option which not requiere be solicited by the accusation.
There is another important difference between the provisional prison and the provisional liberty. The provisional prison is a personal preventive measure which has a huge impact on the right to personal liberty of the investigated, as consequence of this, the law established a temporal limit to imprison an investigated under the legal protection of this personal preventive measure (art. 504 LECrim). Whereas in the case of the provisional liberty, we don’t find any provisión in the law which restricts to a specific period the application of this preventive measure, so we can understand that its application is temporarily unrestricted, at least as far as the investigation continues or there is not a sentence that has putted an end to the process.
Another thing we have to bear in mind is that, the status of a investigated can change during the process. It is possible that the risk of flight of the investigated vanished during the investigation because his personal circumstances has changed, or that the investigation has shown serious doubts about his authorship, in these cases the judge can change the provisional prison for a provisional liberty, or even a provisional liberty for a provisional prison (art. 539 LECrim). The transformation of a provisional prison or a provisional liberty with bait into a provisional liberty without bait, will not need of the audience fo the article 505, but the transformation of a provisional liberty without bail into a provisional prison or a provisional liberty with bait will require of this audience where the accusation should ask specifically for some of these preventive measures.   
Therefore as we have seen trough this lines, there are important nuances which differentiate a personal preventive measure from other, the fundamental right affected, the temporal limit applicable, or if the judge need the audience of the article 505 to apply them. But in essence the three search the same, assure the presence of the investigated during all the process, avoid the destruction of proofs and the possibility of more crimes.