This is really about whether the hypothesized circumstances can count as an acquittal. If there has been an acquittal in normal circumstances (the case made it to court, the defendant was found not guilty, nothing corrupt happened, the court was competent and acting within its jurisdiction, there is no new evidence, the crime isn't a special one like terrorism, etc.) then that is certainly enough to stop a second trial, even if the first one happened abroad. If the case was not tried in Spain at all, then the UK trial would be the first one and there is no double jeopardy involved. In the middle - where some sort of judicial process has been engaged, but there hasn't been an acquittal on the merits of the case - there is a bit of a muddle.
As explained below, in the case of Spain there is a special reason why scenario (3) can amount to an acquittal for UK purposes. For many other countries in the world, it would not be considered an acquittal and would not bar a UK trial. The difference is that for European countries, there are treaty rules under which the UK will respect the position of Spanish law as to when a final determination has been reached. With other countries, it will apply UK common-law rules, under which a trial that is halted because of a procedural bar, without the substance of the accusation having been considered, doesn't "count" for double jeopardy purposes.
Foreign acquittals are the same as domestic ones
The availability of the plea "has always applied whether the previous conviction or acquittal based on the same facts was by an English court or by a foreign court" (Lord Diplock in Treacy v DPP [1971] AC 537, further citing cases back to R v Roche (1775) 1 Leach 134). The situation in Scotland is the same. So if there has been an acquittal after a full trial, which ordinarily stands to be proved by showing the judge the relevant documents from the foreign court, then we are done. Again, there are exceptions if the foreign process was totally compromised by corruption, for example.
If the prior proceedings terminated in another way, for example by a prosecutor declining to bring a case to trial, or the court dismissing the case because it had no jurisdiction, then the defendant cannot claim to have been previously acquitted. He might still be able to argue "abuse of process" (or in Scotland, "oppression") as grounds why there should not be a second trial. That can also be offered if the second prosecution isn't an exact duplicate of the first one, but is still so similar that it would be unjust for the prosecutor to have another go at a conviction. All this is regardless of where the first proceedings took place.
The quoted bold text in the question isn't about alleged offences which never made it to court. It's about being tried again for a different formal offence, but on the basis of the same facts for which there has already been an indictment. The same conduct can often be charged in different ways and it is undesirable if someone can be acquitted of (say) "assault occasioning actual bodily harm" only to face trial again for "common assault", for the same incident. But you cannot say that you were previously acquitted if the court has never even heard of you. And a UK court would not be asked to apply Spanish criminal law to imagine whether the defendant might have been acquitted, if a trial had taken place - as in scenarios (1) and (2).
However, there is a weird anomaly...
There is an unusual special case in this question, because there is specific case law on time-barred prosecutions and the application of cross-border double jeopardy protection, for certain European countries. That is because of a treaty - the Convention Implementing the Schengen Agreement - which provides for the transnational application of the ne bis in idem principle, essentially double jeopardy protection. Each signatory is bound to respect the final determination of another signatory's national courts.
Article 54. A person whose trial has been finally disposed of in one Contracting Party may
not be prosecuted in another Contracting Party for the same acts provided that,
if a penalty has been imposed, it has been enforced, is actually in the process of
being enforced or can no longer be enforced under the laws of the sentencing Contracting Party
(The status of the Convention in UK law is a bit tricky to work out. It originated as an independent agreement between a growing number of European states, but was adopted into EU law. It was never fully binding on the UK, famously outside the "Schengen zone" for travel. The UK has now left the EU, but subject to various transitional procedures. Among the "retained EU legislation" which continues to be binding in domestic law is the Council Decision of 29 May 2000 by which the UK agreed to participate in Articles 54-58 of the Schengen Convention. Further, domestic courts will continue to apply pre-Brexit EU case law when it comes to interpreting what this text really means. UK statutes about retrials, e.g. the Double Jeopardy (Scotland) Act 2011, s.10(3), exclude cases covered by Schengen from those where the special retrial procedures can be ordered.)
In 2006, the European Court of Justice addressed whether this principle applies in the case of a time-barred prosecution, in Case C-467/04. The defendants in that case were being tried in Spain, but it appeared that two of them had previously been acquitted by the Supremo Tribunal de Justiça in Portugal "on the ground that their prosecution was time-barred". So this is pretty much the same as the circumstances in the question's scenario (3), although about different countries and offences.
The ECJ decided that "Such a person must therefore be regarded as having had his trial finally disposed of" (para. 28) for the purposes of Article 54, even though different countries have different rules and procedures about limitation. The point is that the signatories have agreed to put mutual trust in their criminal justice
systems, even though there are plenty of differences among the countries.
However, the ECJ also found that in order for the principle to kick in, there must have been a trial at which the matter was "finally disposed of" (paras 34-37). There is some subtlety about what "finally" means, given differing approaches about when a prosecution could be paused or halted, and then restarted, but the court here put weight on the word "trial" appearing in the Convention text. The thrust of the case law, and see e.g. Case C-398/12 of 5 June 2014, is to respect whatever the original national criminal justice system considers to be final. In the scenarios in the question, the idea is that if at any point the law of Spain considers there to be an acquittal which would bar any further prosecution, then the UK would have to respect that acquittal.
This has the perverse outcome that if a criminal charge were brought in Spain and then immediately dismissed because of the time-bar, then it would also bar a UK prosecution; but if it were not brought at all, then the UK prosecution could go forward, since the matter has never been before the courts. So in this scenario, the accused would actually want there to be a futile Spanish prosecution.
This precedent is not completely determinative of what might happen in reality, since a British court could end up distinguishing the circumstances or the rationale. For example, part of the grounds for the decision in 2006 was that the purpose of the Schengen Convention was to give free movement rights to the defendants, which they wouldn't be able to enjoy if they faced potential prosecution in other member states. That purposive reading does not apply to the UK's situation.