Tourism in Gibraltar constitutes one of the British Overseas Territory's most important economic pillars, alongside financial services and shipping.
Gibraltar's main attractions are the Rock of Gibraltar and its resident population of Barbary macaques or "apes", the territory's military heritage, duty-free shopping, casinos and marinas.
Although the population of Gibraltar numbers only some 30,000 people,the territory recorded nearly 12 million visits in 2011,giving it one of the highest tourist-to-resident ratios in the world.
The Government of Gibraltar has sought to develop the tourism sector to replace Gibraltar's former dependence on the British military, its chief economic mainstay until cuts in the UK's Ministry of Defence budget led to the gradual run-down in the military presence after the 1980s.
Gibraltar's marinas one of which was the first to have been built in the region have made Gibraltar an important hub for sea transport for over 50 years.
A tourist boom began in the mid-1980s but stalled by the end of the decade before being boosted again in the mid-1990s by a programme of Government investment and marketing.
The building of the new Gibraltar Cruise Terminal, a new airport terminal, pedestrianisation of key streets, redevelopment of historic buildings in the city centre and improvements to tourist attractions elsewhere on the peninsula have helped to increase tourist numbers considerably since the turn of the 21st century.
For much of Gibraltar's history as a British territory, its economy relied on its dual status as a key British military base and a trading entrepôt at the entrance to the Mediterranean Sea.
Tourism first became significant between the two World Wars and expanded considerably after World War II due to the opening of Gibraltar's first marina, built in 1961, as it was the first in the region and began to attract increasing numbers of yachts and cruise ships.
Gibraltar's tourist trade was devastated by the Spanish government's 1969 decision to implement a total closure of the Gibraltar-Spain border as a consequence of the political dispute over Gibraltar's status.
Visitor numbers collapsed over the subsequent decade.The border was not reopened but partially) until 1982 and was finally reopened fully on 5 February 1985.
A flood of visitors poured into the territory after the border reopened; 45,000 people entered Gibraltar within the first week, rising to over 10,000 per day over Easter 1985.
Within only six months, a million people had visited, rising to two million by the end of the year.
Air traffic doubled as tour operators began offering packages combining Gibraltar with the Costa del Sol.
By 1986, five million visitors a year,60,000 weekly were arriving in Gibraltar.
The airport resumed its role before the frontier closure of acting as a gateway to the Costa del Sol; 90,000 visitors came by air annually, of whom 22,000 headed on to the resorts of the Costa del Sol.
To make room for the expected flood of visitors' cars on Gibraltar's crowded roads, 1,000 old vehicles were rounded up and pushed off the cliffs into the sea at Europa Point at the southern tip of the territory.
Despite this drastic measure, parking spaces were in critically short supply as over 1,000 vehicles per day entered Gibraltar after the reopening of the border.
The territory enjoyed a retail, accommodation and catering boom, though it came at the price of chronic traffic problems and threats to the environment, notably disturbances to the macaque and bird populations.
The number of macaques grew very rapidly as a result of illegal feeding by tourists, which also led to an increase in aggressive behaviour as the monkeys came to associate humans with food.
The problems culminated in 2008 with the Government of Gibraltar ordering the culling of a rogue group of monkeys that was breaking into hotel rooms and scavenging in bins in the Catalan Bay area.
The cull was protested by researchers and animal rights campaigners but was justified by the Government on the grounds that the overly aggressive monkeys would frighten tourists and cause damage to the economy.
The running-down of the British military presence in Gibraltar in the 1980s and 1990s forced the territory's Government to carry out a major shift in its economic orientation, with a greater emphasis on encouraging tourism and establishing self-sufficiency.
By this time, however, tourist growth had stalled with hotel bed occupancy in the territory at under 30% in 1993.
Tourism became an important issue in the elections of 16 May 1996.
The newly elected Chief Minister, Peter Caruana, pledged to revive Gibraltar's faltering economy by expanding the tourist trade.
The new Government carried out a programme of improvements to the port facilities including the construction of a new passenger terminal to welcome cruise ship visitors.
New marketing initiatives were established, such as Gibraltar joining the MedCruise Association to help promote the Mediterranean as a cruise destination and establish common standards for port facilities.
£5.2 million was invested in improving the airport terminal, while Main Street was refurbished and pedestrianised. A number of old garrison buildings were redeveloped for leisure and retail use, notably the area around Grand Casemates Square, which was formerly used as a car park.
The tourism improvement programme led to a major increase in visitor numbers, which rose from four million in 1996 to seven million in 2001 and overnight stays also rose by 30%.
By 2006 tourism contributed more to Gibraltar's economy than any other sector,with visitors spending an estimated £279.41 million in 2011.
In 2014, a popular newspaper placed Gibraltar on its list of 10 most "disappointing" tourist locations.
In 2011, 11,940,543 visitor arrivals were recorded in Gibraltar, of whom 11,424,581 arrived by land, 351,534 by sea and 164,428 by air; the number of land arrivals excluding cross-border workers was 9,616,781.
Visitor demographics are dominated by day-trippers from neighbouring Spain,90 per cent of visits are made on excursions from Spain, either local Spanish people or Britons visiting or residing in Spain, many coming from the nearby Costa del Sol.
A smaller number of visitors, mostly from the United Kingdom, stay for at least one night in the territory.
The average stay is 4.1 nights as of 2011.Tourism is generally year-round thanks to Gibraltar's hospitable climate, with the August peak only about 50% higher than the January low.
The numbers and relative proportions of visitors have changed considerably over the last 40 years.
During the years of the closure of the land border, the majority of visitors arrived by sea. The number arriving by sea remained fairly stable until the mid-1990s but has grown considerably since then due to an increasing number in visits from cruise ships, over 100 of which now visit annually.
The number of arrivals by air rose through the 1980s to a peak of 62,438 in 1989 but stagnated for some years afterwards, rising only to 66,219 in 1996.
Numbers increased substantially during the 2000s as low-cost airlines Monarch and EasyJet launched flights to the territory.
As of 2011, air arrivals constitute only about 1.4% of all visitors, down from 38% in 1974 during the frontier closure.
Both air and sea traffic is dominated by British visitors; over 80% of departing air passengers leave for the UK, while 93% of cruise passengers are also British.
By contrast, nearly 80% of day visitors by land,thus effectively 80% of all visitors are Spanish nationals.
Gibraltar's tourist trade is hindered by a number of factors. The small size of the territory means that there is an acute shortage of land for expanding tourist facilities and major pieces of infrastructure such as the Gibraltar airport.
Accommodation constituting hotels, guesthouses and self-catering facilities is consequently limited.
Smuggling between Gibraltar and Spain remains a source of tension between the two governments and occasionally leads to long delays for vehicle traffic crossing the border during Spanish Civil Guard crackdowns.
The ongoing political dispute with Spain has also hampered the development of transport links.
It was not until as recently as December 2006, following the signing of the Cordoba Agreement, that direct flights between Madrid and Gibraltar were re-established, Air traffic had previously been obstructed at previous times, flights to and from Gibraltar were not even permitted to fly over Spain as the Spanish did not recognise the British sovereignty over the land where the airport is located and demanded a joint operation of it and the right to treat the airport as a domestic Spanish facility.
The Gibraltarians resisted this as a de facto breach of their territorial integrity and sovereignty.
Since the 2006 Agreement between Britain and Spain, air travel to and from Gibraltar has been conducted without hindrance.