EU law applies to Gibraltar pursuant to Article 355 (3) TFEU which provides that the Treaty shall apply to “European territories for whose external relations a Member State [the United Kingdom] is responsible”. Gibraltar is such a territory. Thus, whereas EU law applies to the United Kingdom by virtue of Article 52 (1) TEU (which lists the Member States of the EU), it applies to Gibraltar by virtue of the separate provision contained in Article 355 (3) TFEU. This is consistent with the fact that Gibraltar does not form part of the United Kingdom.
Numerous judgments of the European Courts have confirmed this. For instance, in Case C-145/04 Spain v United Kingdom  ECR I-7961 the Grand Chamber of the Court of Justice confirmed that “Gibraltar..does not form part of the United Kingdom” and that under EU law “Gibraltar is a European territory for whose external relations a Member State is responsible” under Article 355 (3) TFEU1.
Gibraltar is the only territory to which EU law substantially applies by virtue of Article 355 (3) TFEU2.
Therefore, since the United Kingdom’s accession to the then European Economic Community on 1 January 1973, the Treaties have applied to Gibraltar subject to the limited exceptions set out in Articles 28 – 30 of the 1972 UK Act of Accession. These exceptions are the following:
Aside from the above, Gibraltar does not form part of the Schengen Area as the United Kingdom opted out of the Schengen Agreement. Thus, Spain's border with Gibraltar is considered an external border of the Schengen area. Moreover, because of the United Kingdom’s opt-out from the third stage of the EU’s Economic and Monetary Union, Gibraltar has not adopted the single currency.
EU law is given effect in Gibraltar by the European Communities Act 1972, which is primary legislation passed by the Gibraltar Parliament, and not by virtue of the UK’s own European Communities Act 1972 which gives effect to EU law in the United Kingdom. Neither the UK European Communities Act 1972 nor subsidiary legislation adopted under it apply to, or form part of the laws of, Gibraltar.
Section 47 (3) of the Gibraltar Constitution provides:
“Without prejudice to the United Kingdom’s responsibility for Gibraltar’s compliance with European Union law, matters which under this Constitution are the responsibility of Ministers shall not cease to be so even though they arise in the context of the European Union.”.
This means that EU matters are not treated as “external affairs” within Gibraltar’s internal constitutional order. They are matters for which HMGoG is responsible.
Thus, HMGoG and the Gibraltar Parliament are responsible for the transposition and implementation of all EU measures within the internal legal order of Gibraltar in the same way as any national parliament and government does in every Member State. The UK transpositions have no effect in Gibraltar.
1 See also, Case C-30/01, Commission v United Kingdom  ECR I- 9481 and Joined Cases T-211/04 and T-215/04, Government of Gibraltar and United Kingdom v Commission  ECR II-2309.
2 The Crown Dependencies (Jersey, Guernsey and Isle of Man) are also covered by Article 355 (3) TFEU. However, by virtue of Protocol 3 to the UK’s Act of Accession of 1972 they are excluded from the application of EU law except for agricultural and free movement of goods purposes.