Café Mambo heaves with dancers, drinkers and bouncers. Set in the middle of the sunset strip of San Antonia, Ibiza, it draws a fascinating mix of nationalities, all grooving to the island's distinctive style of electronic music, a blend of its colourful past and present.

Not the best metaphor for food? You would be surprised. The music from this Spanish island has been influenced by outsiders for decades. Similarly its food has been shaped and moulded by inhabitants and invaders, rulers and conquerers, traders and travellers for centuries. Which is why Ibiza's cuisine is so distinctly different from not just mainland Spain, but also the other major members of the Balearic chain of islands: Mallorca, Menorca and Formentera.

Floating near Spain's Eastern coast, the islands of Ibiza and Formentara were particularly important to traders and sailors because of their location, between Western Europe and North Africa's Barbary Coast. Ships headed to the Strait of Gibraltar took advantage of local currents and favourable winds in the passage between Ibiza and Formentera. But this also meant the islands had to weather centuries of invaders.

Once called the Pityusa islands, they've been everything from a pirate base to the crucible of hippydom. With each wave of new inhabitants, the food of this once simple, rural peasant community has changed dramatically. Vivid proof of how history determines how we eat.

In Evissa town we dig into Spanish paella chunky with chewy cuttle fish, oversized prawns and pretty mussels. The restaurant is charming, set in a sun-dappled courtyard. The service is terrible, supercilious and ineffectual. This is reportedly the island's biggest problem right now. Even as the government tries to draw tourists with interests beyond clubbing, the island's restaurants are so used to the well-heeled party crowd, more insistent on atmosphere than food, that they don't bother to do much much more than hike prices periodically.

It's a pity. For Ibiza is really a flamboyant lesson in how a cuisine can grow.

A few hundred years ago, this was a land sustained by Mediterranean cooking. Food was influenced by Catalonia as well as Valencia, just a ferry ride away. Valencia, by the way, is the setting of the riotous Tomatina festival, now propelled into fame in India thanks to Hrithik Roshan breathily squishing overripe tomatoes on Katrina Kaif in “Zindagi Na Milegi Dobara”. (And let's not even get started on what that is a metaphor for!)

When the Phoenicians arrived, around the 8th Century BC, they introduced salt pans, which went on to become one of Ibiza's most important exports. Today the pans, set in La Salinas are a magnificent sight, hills of salt glittering in the bright sunshine. Sal de Ibiza, the island's most popular export, states that 25,000 tons of salt were being sold per year even in 1235 AD. In an age when anything natural is revered, they take pride in the fact that their product does not undergo any processing “other than slow drying under the sun and gentle grinding in ancient stone mills, (thus retaining) more than 80 vital minerals and trace-elements.”

The Carthaginians who followed refined the island's agriculture. Roman gourmands introduced rich, lavish food for banquets. Then came the Arabs around 900 BC, introducing irrigation as well as food from the Far East, legumes like chickpeas, citrus fruit, rice, spices. And since they loved desserts, the cultivation of sugar cane.

In Ibiza today, if you move away from the party zones, you find scenic homes that have opened their doors to tourists. Speciality shops sell the island's distinctive sheep and goat cheese, sausages and olive oil. They're even promoting their own wine and herb liqueur now.

At the airport I pick up a A Taste of Ibiza & Formentera: Traditional Island recipes in which authors Joana and Jose Manuel Pina trace the past, with appetisingly glossy photographs by Vicent Mari. It lists the simple everyday foods of frugal households: doughnut fritters, bread with olive oil and chocolate, warm milk with chunks of yesterday's bread. Then there are the more elaborate stews and soups, made with ingredients shaped by seasons, availability and a reluctance to waste anything: chickpeas, broad beans, pork bones, chicken giblets, entrails and tongue. Rice with lobster, pork, squid ink…

As for sweet endings? Dream about this. A soft cheese tart flavoured with spearmint. Pasta with cinnamon and lemon. And spicy Christmas bread fragrant with anise, lemon zest and cinnamon.