Generate word list based on Spanish text file
Some notes:


open + read + close: Better to use the block form: contents = File.open(path) { |fd| fd.read  } or simply contents = File.read(path)
words = words.something: Don't re-use variable names. New values, new names. For example: sorted_words = words.sort.
Use File.write
Instead of removing chars that you don't want, I'd remove the chars that you do want. 
You can apply the processing to the whole file or line and then split.
string.tr(something, '') -> string.delete(something).


I'd write:

words = File.read("quijote.txt").downcase.
  tr("ÁÉÍÓÚÑ", "áéíóúñ").delete("^[a-z]áéíóúüñ \n").
  split.uniq.sort
File.write("quijote-words.txt", words.join("\n"))


If your input file is not UTF8-encoded but, let's say, ISO8859-15, you'd write: File.read("quijote.txt", encoding: "iso8859-15").encode("utf-8").