Beginning in about the 12th century, Spanish scribes (whose job it was to copy documents by hand) used the tilde placed over letters to indicate that a letter was doubled (so that, for example, nn became ñ and aa became ã). I'm not sure why they used the tilde, except perhaps that it was quick to write, although it may be no coincidence that it is shaped vaguely like an N. The tilde was used not only with the n but with other letters as well.
The popularity of the tilde for other letters eventually waned, and by the 14th century, the ñ was the only place it was used. Its origins can be seen in a word such as año (which means "year"), as it comes from the Latin word annus with a double n. As the phonetic nature of Spanish became solidified, the ñ came to be used for its sound, not just for words with an nn. A number of Spanish words, such as señal and campaña, that are English cognates use the ñ where English uses "gn," such as in "signal" and "campaign," respectively.
The Spanish ñ has been copied by two other languages that are spoken by minorities in Spain. It is used in Euskara, the Basque language that is unrelated to Spanish, to represent approximately the same sound as it has in Spanish. It is also used in Galician, a language similar to Portuguese. (Portuguese uses nh to represent the same sound.)
Additionally, three centuries of Spanish colonial rule in the Philippines led to the adoption of many Spanish words in the national language, Tagalog (also known as Pilipino or Filipino). The ñ is among the letters that have been added to the traditional 20 letters of the language.
And while the ñ isn't part of the English alphabet, it frequently is used by careful writers when using adopted words such as jalapeño, piña colada or piñata and in the spelling of various personal and place names.
In Portuguese, the tilde is placed over vowels to indicate that the sound is nasalized. That use of the tilde has no apparent direct connection with the use of the tilde in Spanish.
Addendum: After this article was published, I received the following letter which has some excellent information:
- Thanks for including the interesting page on the history of the ñ in the about.com pages.
- The word "tilde" actually refers to both the squiggle over the Ñ as well as the accent mark used to mark phonetic stress (e.g., café). There is even the verb "tildarse", which means, "to be written with an accent mark, to stress", as in "La palabra 'café' se tilda en la e".
- The unique character of the letter Ñ has led to its becoming a marker of Hispanic identity in recent years. There is now a "generación Ñ", the children of Spanish-speaking parents in the U.S. (parallel to Generation X, etc.), a stylized Ñ is the logo of the Cervantes Institute (http://www.cervantes.es), and so forth.
- The squiggle under the ç in Portuguese and French has a similar origin as the ñ. It is called a "cedille", meaning "little Z." It comes from the diminutive of the Old Spanish name for the letter Z, ceda. It was used to represent the "ts" sound in Old Spanish, which no longer exists in the language. E.g., O.Sp. caça (katsa) = Mod. Sp. caza (casa or catha).
- Restaurants in the U.S. now offer dishes made with a very spicy pepper, the habanero, which is frequently mispronounced and misspelled as habañero. Since the name comes from La Habana, the capital of Cuba, this pepper should not have Ñ. I think the name has been contaminated by jalapeño, which of course is simply a pepper from Jalapa, Mexico.
In a few places you express uncertainty about some of the details of this history; below I offer the information you need to complete the story.
"Although it may be no coincidence that it is shaped vaguely like an N." It is in fact no coincidence! The reason the "tilde" appears over an N (as in Latin ANNU > Sp. año) and Portuguese vowels (Latin MANU > Po. mão) is that scribes wrote a small letter N over the preceding letter in both cases, to save space in manuscripts (parchment was expensive). As the two languages developed phonetically away from Latin, the double N sound of Latin morphed into the current palatal nasal sound of the Ñ, and Portuguese N between vowels got deleted, leaving its nasal quality on the vowel. So readers and writers began to use the old spelling trick to indicate the new sounds that did not exist in Latin. (It's really nice the way you framed the Ñ as the only Spanish letter of Spanish origin!)
Also of potential interest to your readers:
Associate Professor of Spanish
Director of Language Instruction
Department of Romance Languages
University of Oregon