I believe everyone would agree that learning the gender of Spanish nouns is best done by
memorization,
after consulting a dictionary. There are general rules that apply well to a great many words, but there are exceptions to the rules.
When I hear a noun used for the first time, I make a mental note of what gender was attached to it by the speaker so that I can immediately use it again in the same vein. Later, I consult a dictionary to learn the definite articles associated with the noun. Without this step, I would mistakenly say 'los aguas' when trying to guess at the plural for 'el agua'. A dictionary lookup is an absolute must if the noun names a person or an animate object, because both the masculine and feminine forms need to be memorized.