Answer:
The main benefit that Gibraltar obtains from its location is economic: this is a place where the Mediterranean Sea connects with the Atlantic Ocean, and as a result, any vessel crossing that route has to pass over the city of Gibraltar.
This means an active port, a good and healthy economy, and many opportunities for trade.
Another benefit is strategic. This location is crucial in a geopolitical sense, not only for Gibraltar interests, but also from United Kingdom interests, and this is why the United Kingdom has never accepted to grant independence to the city of Gibraltar, let alone cede it over to Spain.