The article is dedicated to one of the most important problems of Spain's foreign policy – territorial, namely the problem of two Spanish enclaves located on the territory of Morocco – Ceuta and Melilla, as well as Gibraltar. The historical and legal provisions form the basis of arguments of Spain, Morocco and Great Britain substantiating their claims to these disputed territories. A comparison is made between the problems of Ceuta/ Melilla and Gibraltar. Particular attention is paid to the question of whether Ceuta and Melilla are covered by NATO's security guarantee. Morocco is using the issue of Ceuta and Melilla as an instrument to exert pressure on Spain in order to get benefits in other areas, including immigration, trade and fishing as well as to change its position on the Western Sahara. It is emphasized that illegal immigration mostly from sub-Saharan countries is one of the main problems in Spanish-Moroccan relations, complicating the situation in Ceuta and Melilla. This problem is far from being resolved. The Anglo-Spanish dispute over Gibraltar is determined by its important strategic position and the presence of the NATO naval base. The necessity to respect the rights of an absolute majority of its population is empathized. For the UK, the question of Gibraltar is primarily associated with the challenge of maintaining its military-strategic position in the Mediterranean, for Spain – with the problem of its sovereignty and territorial rights. Currently, there is a process of “natural integration” between Gibraltar and adjacent Spanish territory. Spanish experience in resolving the territorial dispute over Gibraltar is important as a practical experience of long-term and complex negotiations. Its final solution must be sought through development of integration processes in Europe. The main task of the Western countries regarding Spanish territorial problems is the maintenance of stability in the region, which perfectly meets the interests of Spain. Madrid's efforts are focused primarily on prevention of such development of political and economic situation, which would force the country to strengthen its southern border by military means. This strategic objective has become particularly relevant in the context of recent events in North Africa.