The word “tapas” is derived from the Spanish/Portuguese verb tapar, “to cover”, a cognate of the English top.
In pre-19th century Spain tapas were served by posadas, albergues, or bodegas, offering meals and rooms for travellers. Since few innkeepers could write and few travellers read, inns offered their guests a sample of the dishes available, on a “tapa” (the word for pot cover in Spanish).
According to The Joy of Cooking, the original tapas were thin slices of bread or meat which sherry drinkers in Andalusian taverns used to cover their glasses between sips. This was a practical measure meant to prevent fruit flies from hovering over the sweet sherry. The meat used to cover the sherry was normally ham or chorizo, which are both very salty and activate thirst. Because of this, bartenders and restaurant owners created a variety of snacks to serve with sherry, thus increasing their alcohol sales. The tapas eventually became as important as the sherry.