Operation Felix was the codename for a proposed German seizure of Gibraltar during the Second World War. It never got beyond the staff study stage, even though planning continued into 1944, primarily because of Francisco Franco's reluctance to commit Spain to enter the war on the Axis side.

Following the fall of France to Germany in June 1940, Hermann Göring advised Adolf Hitler to occupy Spain and North Africa rather than invade Britain. As early as June 1940, before the armistice with France had been signed, General Heinz Guderian also argued for seizing Britain's strategically important naval base of Gibraltar. Guderian even urged Hitler to postpone the armistice so that he could rush on through Spain with two Panzer divisions, take Gibraltar, and then invade French North Africa. General Alfred Jodl, chief of Oberkommando der Wehrmacht (OKW) operations, presented Hitler with a formal plan to cut off Britain from its eastern empire by invading Spain, Gibraltar, North Africa, and the Suez Canal instead of invading the British Isles.

On July 12, 1940, the OKW set up a special group for the necessary planning. On July 22, 1940, Admiral Wilhelm Canaris, the head of the Abwehr and an acknowledged expert on Spain, travelled with several other German officers to Madrid, Spain, where they held talks with General Francisco Franco and General Juan Vigón, his Minister of War. They then travelled on to Algeciras, where they stayed some days to reconnoiter the approaches to Gibraltar. They returned to Germany with the conclusion that Franco's regime was reluctant to enter the war. However, it has since become known that Canaris was disloyal to Hitler and actually encouraged Franco not to join the Axis, since an Allied victory was almost certain. Canaris' team did however determine that Gibraltar might be seized through an air-supported ground assault involving at least two infantry regiments, three engineer battalions, and a dozen artillery regiments. Canaris declared that without 15 inch heavy assault cannon - which he knew were unavailable - Gibraltar could not be taken. When he reported to Field Marshal Wilhelm Keitel, he gave his personal opinion that even if Germany were able, with the cooperation of Spain, to seize Gibraltar, the British would land in Morocco and French West Africa.

On July 18, Franco claimed Gibraltar. He did not expect the British to accede to the claim and made it to keep Germany from attempting to take it.

In August, Canaris met with Franco's brother in law, Ramón Serrano Súñer, who was about to become Spain's Foreign Minister. Canaris urged Súñer to do what he could to convince Franco to stay out of the war. Soon after, Franco dispatched Súñer to Berlin to get an idea of Hitler's attitude, since Canaris had assured him that Germany would not forcibly intervene in Spain. When Súñer met Hitler on September 16, Hitler did not press very hard for Spanish involvement in the war, perhaps because he planned to meet Franco himself very soon.

Canaris met with Franco around the same time and warned him that if Spain joined the Axis, the Spanish islands - even mainland Spain itself - would be at risk from British attack. Knowing that Franco feared a hostile German invasion of Spain if he refused to cooperate, Canaris informed him that Hitler had no such intention due to the planned invasion of Russia. Canaris also surprised Franco by admitting that he was convinced Germany could not win the war.

On August 8, made confident by the secret talks with Canaris, Franco presented extravagant terms for his cooperation to the German Ambassador to Spain, Eberhard von Stohrer; he said that he would only join Hitler if Spain were promised Gibraltar and French Morocco. Germany must also promise military and economic assistance in the form of wheat and oil to help Spain's faltering economy. Additionally, German forces must first land on the British mainland in a full-scale invasion.

This provoked Hitler to send Canaris to Spain again in an effort to convince Franco to join the Axis and soften his "outrageous" demands. To the contrary, Canaris once more reminded Franco that it would be foolish to join the side that was doomed to lose the war.

On August 24, Hitler approved a general plan for seizing Gibraltar. In October, he met with Franco at Hendaye, France, and proposed that Spain enter the war on the Axis side in January 1941; Gibraltar would be taken by special Wehrmacht units and turned over to Spain. Franco however refused the offer, emphasizing Spain's need for large-scale military and economic assistance and Hitler took offence when Franco expressed doubts about the possibility of a German victory. Franco pointed out that even if the British Isles were invaded, Britain's fleet would continue to fight from Canada with US support.

A meaningless memorandum of understanding was signed at Hendaye by Franco and Hitler, neither side getting what they wanted. Hitler is reported to have later told Benito Mussolini, "I would rather have four teeth pulled out than go through that again!"